def saliancey2range(resolution_control=0.005): for j, i in enumerate(f_list): print(' point cloud is', i) pc = PointCloud(i) pc.down_sample(number_of_downsample=2048) for k in range(4): if k == 0: k = -0.5 fig = pc.compute_key_points(percentage=0.1, show_result=False, resolution_control=resolution_control, rate=0.05 * k + 0.05, use_deficiency=False, show_saliency=True) f = mlab.gcf() # this two line for mlab.screenshot to work f.scene._lift() img = mlab.screenshot() mlab.savefig(filename=str(j) + str(k) + '_without.png') mlab.close() fig = pc.compute_key_points(percentage=0.1, show_result=False, resolution_control=resolution_control, rate=0.05 * k + 0.05, use_deficiency=True, show_saliency=True) f = mlab.gcf() # this two line for mlab.screenshot to work f.scene._lift() img = mlab.screenshot() mlab.savefig(filename=str(j) + str(k) + '_with.png') mlab.close() del pc
def key_points_plot(flist): for i in flist: Pc = PointCloud(i) Pc.down_sample(4096) fig = Pc.compute_key_points(percentage=0.1, resolution_control=None, show_result=True) f = mlab.gcf() # this two line for mlab.screenshot to work f.scene._lift() img = mlab.screenshot() mlab.savefig(filename=str(i) + 'key_points.png') mlab.close() fig = Pc.compute_key_points(percentage=0.1, resolution_control=0.01, show_result=True) f = mlab.gcf() # this two line for mlab.screenshot to work f.scene._lift() img = mlab.screenshot() mlab.savefig(filename=str(i) + 'key_points_with_resolution_ctrl.png') mlab.close()
def knn_plot(pc_path=''): f_list = [ base_path + '/' + i for i in os.listdir(base_path) if os.path.splitext(i)[1] == '.ply' ] for j, i in enumerate(f_list): if j < 4: pc = PointCloud(i) pc.down_sample(number_of_downsample=4096) pc.add_noise(factor=0.04) pc.add_outlier(factor=0.04) fig = pc.compute_key_points( percentage=0.02, resolution_control=1 / 15, rate=0.05, use_deficiency=False, show_result=True) # get the key points id f = mlab.gcf() # this two line for mlab.screenshot to work f.scene._lift() mlab.savefig(filename=str(j) + '_0.png') mlab.close() colorset = np.random.random((100, 3)) fig = pc.generate_k_neighbor(k=32, show_result=True, colorset=colorset) f = mlab.gcf() # this two line for mlab.screenshot to work f.scene._lift() mlab.savefig(filename=str(j) + '_1.png') mlab.close() fig = pc.generate_k_neighbor(k=64, show_result=True, colorset=colorset) f = mlab.gcf() # this two line for mlab.screenshot to work f.scene._lift() mlab.savefig(filename=str(j) + '_2.png') mlab.close() fig = pc.generate_k_neighbor(k=128, show_result=True, colorset=colorset) f = mlab.gcf() # this two line for mlab.screenshot to work f.scene._lift() mlab.savefig(filename=str(j) + '_3.png') mlab.close()