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> >;
80 seed_ (static_cast<unsigned int> (time (nullptr)))
138 return (
static_cast<float>(rand () /
double (RAND_MAX)));
159 using Ptr = shared_ptr<RandomSample<pcl::PCLPointCloud2> >;
160 using ConstPtr = shared_ptr<const RandomSample<pcl::PCLPointCloud2> >;
163 RandomSample () : sample_ (UINT_MAX), seed_ (static_cast<unsigned int> (time (nullptr)))
165 filter_name_ =
"RandomSample";
227 return (
static_cast<float> (rand () /
double (RAND_MAX)));
232#ifdef PCL_NO_PRECOMPILE
233#include <pcl/filters/impl/random_sample.hpp>
shared_ptr< const Filter< pcl::PCLPointCloud2 > > ConstPtr
shared_ptr< Filter< pcl::PCLPointCloud2 > > Ptr
bool extract_removed_indices_
Set to true if we want to return the indices of the removed points.
shared_ptr< Filter< PointT > > Ptr
shared_ptr< const Filter< PointT > > ConstPtr
const std::string & getClassName() const
Get a string representation of the name of this class.
std::string filter_name_
The filter name.
IndicesPtr removed_indices_
Indices of the points that are removed.
FilterIndices represents the base class for filters that are about binary point removal.
float user_filter_value_
The user given value that the filtered point dimensions should be set to (default = NaN).
bool keep_organized_
False = remove points (default), true = redefine points, keep structure.
bool negative_
False = normal filter behavior (default), true = inverted behavior.
PCLPointCloud2::Ptr PCLPointCloud2Ptr
PCLPointCloud2::ConstPtr PCLPointCloud2ConstPtr
PointCloudConstPtr input_
The input point cloud dataset.
typename PointCloud::Ptr PointCloudPtr
typename PointCloud::ConstPtr PointCloudConstPtr
IndicesPtr indices_
A pointer to the vector of point indices to use.
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
unsigned int seed_
Random number seed.
void applyFilter(PCLPointCloud2 &output) override
Sample of point indices into a separate PointCloud.
unsigned int sample_
Number of indices that will be returned.
unsigned int getSample()
Get the value of the internal sample parameter.
RandomSample()
Empty constructor.
void setSeed(unsigned int seed)
Set seed of random function.
void setSample(unsigned int sample)
Set number of indices to be sampled.
void applyFilter(Indices &indices) override
Sample of point indices.
float unifRand()
Return a random number fast using a LCG (Linear Congruential Generator) algorithm.
unsigned int getSeed()
Get the value of the internal seed parameter.
RandomSample applies a random sampling with uniform probability.
void setSeed(unsigned int seed)
Set seed of random function.
float unifRand()
Return a random number fast using a LCG (Linear Congruential Generator) algorithm.
void applyFilter(Indices &indices) override
Sample of point indices.
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 sample_
Number of indices that will be returned.
unsigned int getSeed()
Get the value of the internal seed parameter.
unsigned int seed_
Random number seed.
RandomSample(bool extract_removed_indices=false)
Empty constructor.
IndicesAllocator<> Indices
Type used for indices in PCL.
shared_ptr< ::pcl::PCLPointCloud2 > Ptr
shared_ptr< const ::pcl::PCLPointCloud2 > ConstPtr
A point structure representing Euclidean xyz coordinates, and the RGB color.