PointSet to PointSet registration with random sampling


(Roulbac) #1

I need to register two point clouds; however my point sets have too many points, so it is quite slow to run.
I have followed the example from the IterativeClosestPoint.
A solution I can think of is to randomly sample my point clouds at each iteration, though I don’t think the registration method allows it…
Any workaround for first randomly sampling my PointSets before registering? I looked around but couldn’t find any. Should I write my own filter? Are there any guidelines/best practices for that?

(Matt McCormick) #2

Hi @Roulbac,

Yes, random sampling the points is one good approach.

The points in a PointSet have an integer index. In Python , you could quickly generate integer indices with numpy.random.shuffle and numpy.arange.

In C++, you could reuse the RandomPermutation code used by itk:ImageRandomNonRepeatingConstIteratorWithIndex:

In either case, create a new point set and populated with points from the complete set using the first N indices.

A bonus challenge is to create a class that encapsulates this operation, and contribute it to the community!

(Roulbac) #3

Thank you!
Excited to try and contribute that once I get a bit of a break from school stuff!