from __future__ import print_function from pclpy.pcdio import loadPCDFile from pclpy.filters import VoxelGrid cloud = loadPCDFile('inputCloud.pcd') print( 'Points before filtering: {} data points {}'.format(\ cloud.width * cloud.height, cloud.field_names ) ) vg = VoxelGrid() vg.setInputCloud(cloud) vg.setLeafSize(0.01, 0.01, 0.01) filtered_cloud = vg.filter() print( 'Points after filtering: {} data points {}'.format(\ cloud.width * cloud.height, cloud.field_names ) )
from pclpy.visualization import PCLVisualizer from pclpy.pcdio import loadPCDFile vis = PCLVisualizer() cloud1 = loadPCDFile('inputCloud1.pcd') cloud2 = loadPCDFile('inputCloud2.pcd') id1 = vis.addPointCloud(cloud1) id2 = vis.addPointCloud(cloud2) vis.spin() vis.removePointCloud(id2) vis.spin()
from pclpy.pcdio import loadPCDFile from pclpy.visualization import PCLVisualizer from pclpy.filters import PassThrough from pclpy.registration import IterativeClosestPoint pcd_files = [ 'inputCloud0', 'inputCloud1' ] clouds = [ loadPCDFile(x+'.pcd') for x in pcd_files ] _pass = PassThrough() _pass.setFilterFieldName('z') _pass.setFilterLimits( 0.0, 5.0 ) # filtrar todas for i in range(len(clouds)): _pass.setInputCloud(clouds[i]) clouds[i] = _pass.filter() icp = IterativeClosestPoint() vis = PCLVisualizer() t_cloud = clouds[0] vis.addPointCloud(t_cloud) for i in range( 1, len(clouds) ): icp.setInputSource( clouds[i] ) icp.setInputTarget( t_cloud ) t_cloud = icp.align() vis.addPointCloud( t_cloud ) vis.spin()
from pclpy.visualization import PCLVisualizer from pclpy.filters import VoxelGrid from pclpy.pcdio import loadPCDFile i_cloud = loadPCDFile('cloud0.pcd') vg = VoxelGrid() vg.setInputCloud(i_cloud) vg.setLeafSize(.01, .01, .01) r_cloud = vg.filter() vis = PCLVisualizer() v1 = vis.createViewPort( 0., 0., .5, 1. ) v2 = vis.createViewPort( .5, 0., 1., 1. ) vis.setBackgroundColor( 255, 0, 0, v1 ) vis.setBackgroundColor( 0, 255, 0, v2 ) vis.addPointCloud( i_cloud, v1 ) vis.addPointCloud( r_cloud, v2 ) vis.spin()