Environment: Python-PCL, WIndows 10, Python 3.6
I need to downsample point clouds to a specific number of points. These point clouds vary in size and hence I am stuck. From going through documentation, I understand there are only
VoxelGrid, ConditionalOutlierRemoval ,StatisticalOutlierRemoval and RadiusOutlierRemoval are the options available.
In VoxelGrid, the leaf size doesnt guarantee the number of points, Radius removal doesnt help in retaining the shape, and statistical outlier mostly helps in removing noise.
Is there any solution to this? It is possible to use numpy.random.choice()and hoping for a miracle?
EDIT: numpy.random.choice works but only if you don't care about the geometric shape of your point cloud, which I do. Anyway to use VoxelGrid dynamically?
Unfortunately, the answer is no. The number of output points using PCL's VoxelGrid is always going to be a function of the number of occupied voxels. The only way to control the number of occupied voxels is by altering the leaf size, and there is no dynamic way of doing this.
Alternately, you may have luck using Farthest Point Sampling, as it would allow you to select N points and has nice blue noise properties, but to the best of my knowledge this is not available in PCL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With