python-pcl
python-pcl copied to clipboard
pcl removalradiusremoval doesn't work
Current version PCL 1.7.2 cython 0.25.2 on linux RemovalOutlierRemoval doesn't work properly, even when setting the radius to 10 in the example, there are not points left after filtering.
@KingDeng005, please post the error/ output what you are getting.
import pcl import numpy as np import random
import argparse
parser = argparse.ArgumentParser(description='PointCloudLibrary example: Remove outliers') parser.add_argument('--Removal', '-r', choices=('Radius', 'Condition'), default='', help='RadiusOutlier/Condition Removal') args = parser.parse_args()
cloud = pcl.PointCloud() cloud_filtered = pcl.PointCloud()
points = np.zeros((5, 3), dtype=np.float32) RAND_MAX = 1024.0 for i in range(0, 5): points[i][0] = 1024 * random.random () / RAND_MAX points[i][1] = 1024 * random.random () / RAND_MAX points[i][2] = 1024 * random.random () / RAND_MAX
cloud.from_array(points)
if args.Removal == 'Radius': in_search_radius = 10 min_npts = 1 print 'in search radius = {}'.format(in_search_radius) print 'min npts = {}'.format(min_npts) outrem = cloud.make_RadiusOutlierRemoval() outrem.set_radius_search(in_search_radius) outrem.set_MinNeighborsInRadius(min_npts) cloud_filtered = outrem.filter () elif args.Removal == 'Condition': range_cond = cloud.make_ConditionAnd() range_cond.add_Comparison2('z', pcl.CythonCompareOp_Type.GT, 0.0) range_cond.add_Comparison2('z', pcl.CythonCompareOp_Type.LT, 0.8) condrem = cloud.make_ConditionalRemoval(range_cond) condrem.set_KeepOrganized(True) cloud_filtered = condrem.filter () else: print("please specify command line arg paramter 'Radius' or 'Condition'")
print ('Cloud before filtering: ') for i in range(0, cloud.size): print ('x: ' + str(cloud[i][0]) + ', y : ' + str(cloud[i][1]) + ', z : ' + str(cloud[i][2]))
print ('Cloud after filtering: ') for i in range(0, cloud_filtered.size): print ('x: ' + str(cloud_filtered[i][0]) + ', y : ' + str(cloud_filtered[i][1]) + ', z : ' + str(cloud_filtered[i][2]))
Run command as: python radius_removal.py --Removal=Radius The result is: in search radius = 10 min npts = 1 Cloud before filtering: x: 0.587186992168, y : 0.809742569923, z : 0.101652868092 x: 0.430501133204, y : 0.341296344995, z : 0.581077337265 x: 0.495362758636, y : 0.907591044903, z : 0.225011512637 x: 0.576500594616, y : 0.125343248248, z : 0.532614827156 x: 0.782019376755, y : 0.673046171665, z : 0.805666685104 Cloud after filtering:
Given the in search radius=10 and min removal points=1, the filtered result should be the same as the input. Do you have any idea? Thanks!
I encountered the same problem, need help!
I aslo have same problem, please tell us how to make it work. Thanks!
Same problem, can reproduce it on Windows 10, python-pcl 0.3.
It's still not working in version 1.7 :(
It's still not working in version 1.8.1
has anyone succeeded in this?? :(
Just do it in C++ and leave this quagmire.
Does anyone solve this problem?