38 #ifndef PCL_FILTERS_IMPL_RANDOM_SAMPLE_H_ 39 #define PCL_FILTERS_IMPL_RANDOM_SAMPLE_H_ 41 #include <pcl/filters/random_sample.h> 42 #include <pcl/type_traits.h> 46 template<
typename Po
intT>
50 std::size_t N = indices_->size ();
51 std::size_t sample_size = negative_ ? N - sample_ : sample_;
57 removed_indices_->clear ();
62 indices.resize (sample_size);
63 if (extract_removed_indices_)
64 removed_indices_->resize (N - sample_size);
71 std::size_t index = 0;
72 std::vector<bool> added;
73 if (extract_removed_indices_)
74 added.resize (indices_->size (),
false);
75 std::size_t n = sample_size;
79 const float U = unifRand ();
84 if (extract_removed_indices_)
86 indices[i++] = (*indices_)[index];
97 if (extract_removed_indices_)
100 for (std::size_t i = 0; i < added.size (); i++)
104 (*removed_indices_)[ri++] = (*indices_)[i];
111 #define PCL_INSTANTIATE_RandomSample(T) template class PCL_EXPORTS pcl::RandomSample<T>; 113 #endif // PCL_FILTERS_IMPL_RANDOM_SAMPLE_H_ void applyFilter(std::vector< int > &indices) override
Sample of point indices.