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
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. SoUniformSampling
should inherit fromFilterIndices
. The methodapplyFilter (PointCloud &output)
should be changed toapplyFilter (Indices &indices)
.leaf.second.idx
should be added to the outputindices
, 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 fromFilterIndices
. Documentation forFilterIndices
: https://pointclouds.org/documentation/classpcl_1_1_filter_indices.html