Hello, I am very new Python user, and am just trying to call some simple filter functions, where I already have the point cloud loaded into memory and want to pass it thru the MLS filter. I would rather not save to disk first and then re-read the file due to the time required for both operations. I am assuming I am missing something pretty simple and would appreciate any help to push me in the right direction.
#
def lv_pcl_mls( xpts, ypts, zpts, clrpts, polyfit, polyorder, radius ):
"This is used to Moving Least Squares filter a point cloud using PCL"
xpts_a = np.asarray(xpts, dtype=np.float32, order='C')
ypts_a = np.asarray(ypts, dtype=np.float32, order='C')
zpts_a = np.asarray(zpts, dtype=np.float32, order='C')
clrpts_a = np.asarray(clrpts, dtype=np.float32, order='C')
points = np.transpose([xpts_a, ypts_a, zpts_a, clrpts_a])
#note had to use XYZRGBA instead of XYZRGB in order to show colors correctly, found some notes on web referring to a problem with XYZRGB
#also should note that when loading points from a file the XYZRGB seems to work correctly S. Stecker 10-13-2018
cloud = pcl.PointCloud_PointXYZRGBA(points)
pclpy_cloud = pclpy.api.utils.get_point_cloud_type(cloud)
filteredcloud = pcl.PointCloud_PointXYZRGBA()
#setup the Radius outlier filter parameters
#create a filter class
#set the mean which is the number of points to average - integer
#set the std deviation threshold used to remove points - float
#by setting the set_negative this determines whether to keep the outliers and remove the inliers
fil = pclpy.moving_least_squares( cloud, search_radius=radius, compute_normals=False, polynomial_fit=polyfit, polynomial_order=polyorder, num_threads=8)
#fil = pcl.MovingLeastSquares_PointXYZRGBA(cloud)
#fil.set_polynomial_fit(polyfit)
#fil.set_polynomial_order(polyorder)
#fil.set_search_radius(radius)
#filteredcloud = fil.process()
filteredcloud = fil
visual = pcl.pcl_visualization.CloudViewing()
visual.ShowColorACloud(filteredcloud)
filteredcloud = filteredcloud.to_list()
v = True
while v:
v=not(visual.WasStopped())
return filteredcloud;
Hello, I am very new Python user, and am just trying to call some simple filter functions, where I already have the point cloud loaded into memory and want to pass it thru the MLS filter. I would rather not save to disk first and then re-read the file due to the time required for both operations. I am assuming I am missing something pretty simple and would appreciate any help to push me in the right direction.
# def lv_pcl_mls( xpts, ypts, zpts, clrpts, polyfit, polyorder, radius ): "This is used to Moving Least Squares filter a point cloud using PCL"