RadiusOutlierRemoval semantic

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

RadiusOutlierRemoval semantic

thomasp
Hello there
 
I've got a question regarding RadiusOutlierRemoval  filter.
One can think that with the following code :
 
1.      pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_in = ...  ; // create point cloud
2.      pcl::PointCloud<pcl::PointXYZ> cloud_out ;
3.      //
4.      pcl::RadiusOutlierRemoval<pcl::PointXYZ> filter ;
5.      filter.setInputCloud(cloud_in) ;
6.      filter.setMinNeighborsInRadius(1) ;     // at least one neigbor
7.      filter.setRadiusSearch(Dmax) ;  // search radius
8.      filter.filter(cloud_out) ;
 
Every point of cloud_in that do not have a neighbor in a radius of 'Dmax' will be excluded in 'cloud_out'.
This is not the case. RadiusOutlierRemoval is based on the following kd-tree search :
 
int radiusSearch(const PointT&, const double, std::vector<int>&, std::vector<float> &, unsigned int=0) const
(in kdtree.h, line 165, PCL release 1.5.1)
 
where the first argument is a 3D point. So any point processed in the input cloud counts itself as a neighbor.
This means that with the code above, and even with an exetremely low value for Dmax, no point will be removed.
I felt like there is a semantic problem for the method RadiusOutlierRemoval ::setMinNeighborsInRadius().
 
Could I have feedback on this point ?
 
thanks
 
thomas
 
 

_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: RadiusOutlierRemoval semantic

Radu B Rusu
Administrator
Thomas,

Interesting point. I guess that's one of the main differences between the statistical removal filter and the radius
based one: the latter will look for neighbors around a query point, which means that it will always treat the query
points as "inliers". We could add a flag that changes this behavior. Something along the lines of:

setIgnoreQueryPoint (true)

which results in the query point being treated no different, i.e., if not enough neighbors are found in a given radius,
then the query point itself is an outlier and should be removed. If anyone has free cycles and would like to submit this
as a patch, we could incorporate it in the 1.6 release.

Cheers,
Radu.

On 06/21/2012 01:01 AM, [hidden email] wrote:

> Hello there
> I've got a question regarding RadiusOutlierRemoval filter.
> One can think that with the following code :
> 1. pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_in = ... ; // create point cloud
> 2. pcl::PointCloud<pcl::PointXYZ> cloud_out ;
> 3. //
> 4. pcl::RadiusOutlierRemoval<pcl::PointXYZ> filter ;
> 5. filter.setInputCloud(cloud_in) ;
> 6. filter.setMinNeighborsInRadius(1) ; // at least one neigbor
> 7. filter.setRadiusSearch(Dmax) ; // search radius
> 8. filter.filter(cloud_out) ;
> Every point of cloud_in that do not have a neighbor in a radius of 'Dmax' will be excluded in 'cloud_out'.
> This is not the case. RadiusOutlierRemoval is based on the following kd-tree search :
> int radiusSearch(constPointT&, constdouble, std::vector<int>&, std::vector<float> &,unsignedint=0) const
> (in kdtree.h, line 165, PCL release 1.5.1)
> where the first argument is a 3D point. So any point processed in the input cloud counts itself as a neighbor.
> This means that with the code above, and even with an exetremely low value for Dmax, no point will be removed.
> I felt like there is a semantic problem for the method RadiusOutlierRemoval ::setMinNeighborsInRadius().
> Could I have feedback on this point ?
> thanks
> thomas
>
>
> _______________________________________________
> [hidden email] / http://pointclouds.org
> http://pointclouds.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: RadiusOutlierRemoval semantic

Frits Florentinus
In reply to this post by thomasp
Hi Thomas,

This issue has been resolved in: http://dev.pointclouds.org/issues/614.

The code for the RadiusOutlierRemoval looks as follows:

00104     int k = searcher_->radiusSearch ((*indices_)[iii], search_radius_, nn_indices, nn_dists);
00105
00106     // Points having too few neighbors are outliers and are passed to removed indices
00107     // Unless negative was set, then it's the opposite condition
00108     if ((!negative_ && k <= min_pts_radius_) || (negative_ && k > min_pts_radius_))

So the value k will indeed always be at least 1, and in your situation, with min_pts_radius_ being equal to 1 it should still remove them.

This update has been applied recently and currently only applies to the latest versions of the trunk of PCL.

Cheers,
Frits
Reply | Threaded
Open this post in threaded view
|

RE : RadiusOutlierRemoval semantic

thomasp
good news :) thanks for the info.


To be sure, will I have to change my code when these changes are released ?

that is to say, if I want to remove points having no neihbor in a given radius :

> filter.setMinNeighborsInRadius(2) ; // today's code, because a point is considered as a neighbor of itself

should become :

> filter.setMinNeighborsInRadius(1) ; // next pcl release

??

________________________________________
De : [hidden email] [[hidden email]] de la part de Frits Florentinus [[hidden email]]
Date d'envoi : vendredi 22 juin 2012 11:15
À : [hidden email]
Objet : Re: [PCL-users] RadiusOutlierRemoval semantic

Hi Thomas,

This issue has been resolved in: http://dev.pointclouds.org/issues/614.

The code for the RadiusOutlierRemoval looks as follows:

00104     int k = searcher_->radiusSearch ((*indices_)[iii], search_radius_,
nn_indices, nn_dists);
00105
00106     // Points having too few neighbors are outliers and are passed to
removed indices
00107     // Unless negative was set, then it's the opposite condition
00108     if ((!negative_ && k <= min_pts_radius_) || (negative_ && k >
min_pts_radius_))

So the value k will indeed always be at least 1, and in your situation, with
min_pts_radius_ being equal to 1 it should still remove them.

This update has been applied recently and currently only applies to the
latest versions of the trunk of PCL.

Cheers,
Frits

--
View this message in context: http://www.pcl-users.org/RadiusOutlierRemoval-semantic-tp4019512p4019557.html
Sent from the Point Cloud Library (PCL) Users mailing list archive at Nabble.com.
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
_______________________________________________
[hidden email] / http://pointclouds.org
http://pointclouds.org/mailman/listinfo/pcl-users
Reply | Threaded
Open this post in threaded view
|

Re: RE : RadiusOutlierRemoval semantic

Frits Florentinus
Hi Thomas,

Yes, you are correct there; Unfortunately this code change does require you to subtract the number you put in with setMinNeighborsInRadius by 1. Although for future users it will be better since the value now actually represents the minimum neighbors required in radius.

Frits