How to mark NULL data in Point Cloud Library (PCL) when using Iterative Closest Point (ICP)
Asked Answered
L

1

4

I´m trying to align 2 sets of point clouds using the Iterative Closest Point (ICP) algorithm integrated within Point Cloud Library (PCL). I´m getting an error report saying that it cant find enough correspondence points. I have already relaxed the conditions for the parameters: setEuclideanFitnessEpsilon(-1.797e+5), setMaximumIterations(40) and setRANSACIterations(2000) and still having the same problem.. (I havent found much info about which or how these conditional values should be for a proper alignement, so any help in this regard would be really appreciated too)

I´m suspecting that this problem has to do with the fact that I have many NULL data points in my cloud, which I´ve marked with the value NULL (0). Is that properly done when using PCL? Is there any NULL standard value for PCL? I clearly dont want the algorithm to consider those NULL points when trying to align the data sets..

Thanks for your help

Leong answered 24/6, 2013 at 17:31 Comment(0)
P
8

If you are using PCL, default value of invalid data is not NULL, but is NaN. So if you want to mark a point as invalid, you should first include <limits> file and then set the positions to 'std::numeric_limits::quiet_NaN()'. It is usually done like this

const float bad_point = std::numeric_limits<float>::quiet_NaN();
if( is_invalid_point )
    p.x = p.y = p.z = bad_point;

But anyway, configuring ICP can be a pain. You may have to do a lot more parameter tweaking depending on your data.

Prosody answered 24/6, 2013 at 18:56 Comment(7)
Thanks @Kourosh. It worked with the pcl::visualization::CloudViewer, the NULL points are now not shown when visualizing. However, the aligning is crashing apparently in the kdtree module: Assertion failed: point_representation_->isValid (point) && "Invalid(NaN, Inf) point coordinates given to nearestKSearch!", file: C:\BuildAgent\work\....\tags\pcl-1.6.0\kdtree\include\pcl/kdtreee/impl/kdtree_flann.hpp, line 83. Any idea why?Leong
It seems that Kd-Tree does not expect your pointclouds to have invalid points. Try filtering pointcloud with pcl::removeNaNFromPointCloud and send the resulting pointcloud for ICP. Tell me if it worked.Prosody
BTW, please mark the answer as correct if it is, so others who see this can use the answer.Prosody
It worked Kourosh! thank you! It´s not aligning very well but the module works now =) btw, do you know if very flat point cloud surfaces are specially difficult for PCL::ITC to align?Leong
Glad to help :) I think they should be difficult given the ICP algorithm. In those cases using color information should give you better estimates. Anyway if you don't have to use ICP, there is an implementation of FOVIS algorithm available at code.google.com/p/fovis . It uses image and depth and not pointclouds, so flat surfaces won't be a problem.Prosody
I tried this method also, but I came to conclusion that the transform matrix is not workingBoustrophedon
You would also want to set the cloud's is_dense member to false, if you're making any points NaN cloud.is_dense = falseEmmen

© 2022 - 2024 — McMap. All rights reserved.