norlab-ulaval / libpointmatcher

An Iterative Closest Point (ICP) library for 2D and 3D mapping in Robotics
BSD 3-Clause "New" or "Revised" License
1.58k stars 542 forks source link

KDTreeMatcher has Knn more than 1 #480

Open dasisttao opened 2 years ago

dasisttao commented 2 years ago

Hello!

As far as I know, the ICP algorithm finds the correspondence in Reference for each points from Reading. The correspondence should be represented by the nearst point. (so one single point)

I would like to ask, how it's implemented in this library, when I set the knn of matcher more than 1?

Thanks in advance!

pomerlef commented 2 years ago

There as been many variant of ICP, so libpointmatcher treat them more as a family of algorithms.

If you increase knn, you will generate an error for the second closest, third closest, etc. A large vector is generated and minimized. Here is the fonction converting the match matrix to error elements: https://github.com/ethz-asl/libpointmatcher/blob/master/pointmatcher/ErrorMinimizer.cpp#L101