PointCloudLibrary / pcl

Point Cloud Library (PCL)
https://pointclouds.org/
Other
9.64k stars 4.59k forks source link

[filters] Make `UniformSampling` inherit from `FilterIndices` instead of `Filter` #6051

Closed mvieth closed 1 week ago

mvieth commented 1 month ago

FilterIndices is a special filter where all subclasses decide for each input point: keep or remove. But no new points are added to the output cloud. UniformSampling does exactly that: it removes some points from the input cloud and keeps other points, but it does not create any new points. So UniformSampling should inherit from FilterIndices. The method applyFilter (PointCloud &output) should be changed to applyFilter (Indices &indices). leaf.second.idx should be added to the output indices, see https://github.com/PointCloudLibrary/pcl/blob/master/filters/include/pcl/filters/impl/uniform_sampling.hpp#L146 See also passthrough.h and passthrough.hpp for another filter that inherits from FilterIndices. Documentation for FilterIndices: https://pointclouds.org/documentation/classpcl_1_1_filter_indices.html

QiuYilin commented 4 weeks ago

I can handle it this weekend. Currently, it seems that only UniformSampling is a general sampling method that can keep the point cloud organized.