python-pcl icon indicating copy to clipboard operation
python-pcl copied to clipboard

pcl removalradiusremoval doesn't work

Open KingDeng005 opened this issue 7 years ago • 11 comments

KingDeng005 avatar Jun 09 '18 23:06 KingDeng005

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 avatar Jun 09 '18 23:06 KingDeng005

@KingDeng005, please post the error/ output what you are getting.

niranjanreddy891 avatar Jun 11 '18 04:06 niranjanreddy891

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!

KingDeng005 avatar Jun 12 '18 00:06 KingDeng005

I encountered the same problem, need help!

RyanHangZhou avatar Oct 12 '18 11:10 RyanHangZhou

I aslo have same problem, please tell us how to make it work. Thanks!

LHJ1098826475 avatar Nov 21 '19 12:11 LHJ1098826475

Same problem, can reproduce it on Windows 10, python-pcl 0.3.

mihsamusev avatar Jan 22 '20 14:01 mihsamusev

It's still not working in version 1.7 :(

cmaestre avatar Feb 18 '20 14:02 cmaestre

It's still not working in version 1.8.1

zhulf0804 avatar Mar 09 '20 06:03 zhulf0804

has anyone succeeded in this?? :(

mirellameelo avatar Jun 18 '20 21:06 mirellameelo

Just do it in C++ and leave this quagmire.

benrennison avatar Jun 18 '20 23:06 benrennison

Does anyone solve this problem?

wangzhangfei-hkd avatar Oct 28 '20 14:10 wangzhangfei-hkd