40 #include <pcl/filters/filter_indices.h>
54 template<
typename Po
intT>
73 using Ptr = shared_ptr<RandomSample<PointT> >;
74 using ConstPtr = shared_ptr<const RandomSample<PointT> >;
79 sample_ (std::numeric_limits<unsigned int>::max()),
80 seed_ (static_cast<unsigned int> (time (nullptr)))
138 return (static_cast<float>(rand () / static_cast<double>(RAND_MAX)));
159 using Ptr = shared_ptr<RandomSample<pcl::PCLPointCloud2> >;
160 using ConstPtr = shared_ptr<const RandomSample<pcl::PCLPointCloud2> >;
164 sample_ (std::numeric_limits<unsigned int>::max()),
165 seed_ (static_cast<unsigned int>(time(nullptr)))
167 filter_name_ =
"RandomSample";
221 applyFilter (
Indices &indices)
override;
229 return (static_cast<float> (rand () / static_cast<double>(RAND_MAX)));
234 #ifdef PCL_NO_PRECOMPILE
235 #include <pcl/filters/impl/random_sample.hpp>
shared_ptr< ::pcl::PCLPointCloud2 > Ptr
shared_ptr< PointCloud< PointT > > Ptr
void setSample(unsigned int sample)
Set number of indices to be sampled.
unsigned int getSample()
Get the value of the internal sample parameter.
unsigned int getSeed()
Get the value of the internal seed parameter.
shared_ptr< const ::pcl::PCLPointCloud2 > ConstPtr
RandomSample(bool extract_removed_indices=false)
Empty constructor.
shared_ptr< Filter< pcl::PCLPointCloud2 > > Ptr
unsigned int sample_
Number of indices that will be returned.
unsigned int seed_
Random number seed.
FilterIndices represents the base class for filters that are about binary point removal.
shared_ptr< Filter< pcl::pcl::PCLPointCloud2 > > Ptr
typename PointCloud::Ptr PointCloudPtr
IndicesAllocator<> Indices
Type used for indices in PCL.
PointCloud represents the base class in PCL for storing collections of 3D points. ...
void setSeed(unsigned int seed)
Set seed of random function.
float unifRand()
Return a random number fast using a LCG (Linear Congruential Generator) algorithm.
RandomSample()
Empty constructor.
void applyFilter(Indices &indices) override
Sample of point indices.
PCLPointCloud2::ConstPtr PCLPointCloud2ConstPtr
unsigned int seed_
Random number seed.
shared_ptr< const PointCloud< PointT > > ConstPtr
unsigned int getSample()
Get the value of the internal sample parameter.
std::string filter_name_
The filter name.
shared_ptr< const Filter< pcl::PCLPointCloud2 > > ConstPtr
float unifRand()
Return a random number fast using a LCG (Linear Congruential Generator) algorithm.
shared_ptr< const Filter< pcl::pcl::PCLPointCloud2 > > ConstPtr
A point structure representing Euclidean xyz coordinates, and the RGB color.
unsigned int sample_
Number of indices that will be returned.
RandomSample applies a random sampling with uniform probability.
void setSample(unsigned int sample)
Set number of indices to be sampled.
unsigned int getSeed()
Get the value of the internal seed parameter.
void setSeed(unsigned int seed)
Set seed of random function.
PCLPointCloud2::Ptr PCLPointCloud2Ptr
typename PointCloud::ConstPtr PointCloudConstPtr