Point Cloud Library (PCL)  1.14.1-dev
List of all members | Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
pcl::UniformSampling< PointT > Class Template Reference

UniformSampling assembles a local 3D grid over a given PointCloud, and downsamples + filters the data. More...

#include <pcl/filters/uniform_sampling.h>

+ Inheritance diagram for pcl::UniformSampling< PointT >:
+ Collaboration diagram for pcl::UniformSampling< PointT >:

Classes

struct  Leaf
 Simple structure to hold an nD centroid and the number of points in a leaf. More...
 

Public Types

using Ptr = shared_ptr< UniformSampling< PointT > >
 
using ConstPtr = shared_ptr< const UniformSampling< PointT > >
 
- Public Types inherited from pcl::FilterIndices< PointT >
using PointCloud = pcl::PointCloud< PointT >
 
using Ptr = shared_ptr< FilterIndices< PointT > >
 
using ConstPtr = shared_ptr< const FilterIndices< PointT > >
 
- Public Types inherited from pcl::Filter< PointT >
using Ptr = shared_ptr< Filter< PointT > >
 
using ConstPtr = shared_ptr< const Filter< PointT > >
 
using PointCloud = pcl::PointCloud< PointT >
 
using PointCloudPtr = typename PointCloud::Ptr
 
using PointCloudConstPtr = typename PointCloud::ConstPtr
 
- Public Types inherited from pcl::PCLBase< PointT >
using PointCloud = pcl::PointCloud< PointT >
 
using PointCloudPtr = typename PointCloud::Ptr
 
using PointCloudConstPtr = typename PointCloud::ConstPtr
 
using PointIndicesPtr = PointIndices::Ptr
 
using PointIndicesConstPtr = PointIndices::ConstPtr
 

Public Member Functions

PCL_MAKE_ALIGNED_OPERATOR_NEW UniformSampling (bool extract_removed_indices=false)
 Empty constructor. More...
 
 ~UniformSampling () override
 Destructor. More...
 
virtual void setRadiusSearch (double radius)
 Set the 3D grid leaf size. More...
 
void setMinimumPointsNumberPerVoxel (unsigned int min_points_per_voxel)
 Set the minimum number of points required for a voxel to be used. More...
 
unsigned int getMinimumPointsNumberPerVoxel () const
 Return the minimum number of points required for a voxel to be used. More...
 
- Public Member Functions inherited from pcl::FilterIndices< PointT >
 FilterIndices (bool extract_removed_indices=false)
 Constructor. More...
 
void filter (Indices &indices)
 Calls the filtering method and returns the filtered point cloud indices. More...
 
void setNegative (bool negative)
 Set whether the regular conditions for points filtering should apply, or the inverted conditions. More...
 
bool getNegative () const
 Get whether the regular conditions for points filtering should apply, or the inverted conditions. More...
 
void setKeepOrganized (bool keep_organized)
 Set whether the filtered points should be kept and set to the value given through setUserFilterValue (default: NaN), or removed from the PointCloud, thus potentially breaking its organized structure. More...
 
bool getKeepOrganized () const
 Get whether the filtered points should be kept and set to the value given through setUserFilterValue (default = NaN), or removed from the PointCloud, thus potentially breaking its organized structure. More...
 
void setUserFilterValue (float value)
 Provide a value that the filtered points should be set to instead of removing them. More...
 
- Public Member Functions inherited from pcl::Filter< PointT >
 Filter (bool extract_removed_indices=false)
 Empty constructor. More...
 
IndicesConstPtr const getRemovedIndices () const
 Get the point indices being removed. More...
 
void getRemovedIndices (PointIndices &pi)
 Get the point indices being removed. More...
 
void filter (PointCloud &output)
 Calls the filtering method and returns the filtered dataset in output. More...
 
- Public Member Functions inherited from pcl::PCLBase< PointT >
 PCLBase ()
 Empty constructor. More...
 
 PCLBase (const PCLBase &base)
 Copy constructor. More...
 
virtual ~PCLBase ()=default
 Destructor. More...
 
virtual void setInputCloud (const PointCloudConstPtr &cloud)
 Provide a pointer to the input dataset. More...
 
PointCloudConstPtr const getInputCloud () const
 Get a pointer to the input point cloud dataset. More...
 
virtual void setIndices (const IndicesPtr &indices)
 Provide a pointer to the vector of indices that represents the input data. More...
 
virtual void setIndices (const IndicesConstPtr &indices)
 Provide a pointer to the vector of indices that represents the input data. More...
 
virtual void setIndices (const PointIndicesConstPtr &indices)
 Provide a pointer to the vector of indices that represents the input data. More...
 
virtual void setIndices (std::size_t row_start, std::size_t col_start, std::size_t nb_rows, std::size_t nb_cols)
 Set the indices for the points laying within an interest region of the point cloud. More...
 
IndicesPtr getIndices ()
 Get a pointer to the vector of indices used. More...
 
IndicesConstPtr const getIndices () const
 Get a pointer to the vector of indices used. More...
 
const PointToperator[] (std::size_t pos) const
 Override PointCloud operator[] to shorten code. More...
 

Protected Member Functions

void applyFilter (Indices &indices) override
 Filtered results are indexed by an indices array. More...
 
- Protected Member Functions inherited from pcl::FilterIndices< PointT >
void applyFilter (PointCloud &output) override
 Abstract filter method for point cloud. More...
 
- Protected Member Functions inherited from pcl::Filter< PointT >
const std::string & getClassName () const
 Get a string representation of the name of this class. More...
 
- Protected Member Functions inherited from pcl::PCLBase< PointT >
bool initCompute ()
 This method should get called before starting the actual computation. More...
 
bool deinitCompute ()
 This method should get called after finishing the actual computation. More...
 

Protected Attributes

std::unordered_map< std::size_t, Leafleaves_
 The 3D grid leaves. More...
 
Eigen::Vector4f leaf_size_
 The size of a leaf. More...
 
Eigen::Array4f inverse_leaf_size_
 Internal leaf sizes stored as 1/leaf_size_ for efficiency reasons. More...
 
Eigen::Vector4i min_b_
 The minimum and maximum bin coordinates, the number of divisions, and the division multiplier. More...
 
Eigen::Vector4i max_b_
 
Eigen::Vector4i div_b_
 
Eigen::Vector4i divb_mul_
 
double search_radius_ {0.0}
 The nearest neighbors search radius for each point. More...
 
unsigned int min_points_per_voxel_ {0}
 Minimum number of points per voxel. More...
 
- Protected Attributes inherited from pcl::FilterIndices< PointT >
bool negative_ {false}
 False = normal filter behavior (default), true = inverted behavior. More...
 
bool keep_organized_ {false}
 False = remove points (default), true = redefine points, keep structure. More...
 
float user_filter_value_
 The user given value that the filtered point dimensions should be set to (default = NaN). More...
 
- Protected Attributes inherited from pcl::Filter< PointT >
IndicesPtr removed_indices_
 Indices of the points that are removed. More...
 
std::string filter_name_
 The filter name. More...
 
bool extract_removed_indices_
 Set to true if we want to return the indices of the removed points. More...
 
- Protected Attributes inherited from pcl::PCLBase< PointT >
PointCloudConstPtr input_
 The input point cloud dataset. More...
 
IndicesPtr indices_
 A pointer to the vector of point indices to use. More...
 
bool use_indices_
 Set to true if point indices are used. More...
 
bool fake_indices_
 If no set of indices are given, we construct a set of fake indices that mimic the input PointCloud. More...
 

Detailed Description

template<typename PointT>
class pcl::UniformSampling< PointT >

UniformSampling assembles a local 3D grid over a given PointCloud, and downsamples + filters the data.

The UniformSampling class creates a 3D voxel grid (think about a voxel grid as a set of tiny 3D boxes in space) over the input point cloud data. Then, in each voxel (i.e., 3D box), all the points present will be approximated (i.e., downsampled) with the closest point to the center of the voxel.

See also
VoxelGrid
Author
Radu Bogdan Rusu

Definition at line 60 of file uniform_sampling.h.

Member Typedef Documentation

◆ ConstPtr

template<typename PointT >
using pcl::UniformSampling< PointT >::ConstPtr = shared_ptr<const UniformSampling<PointT> >

Definition at line 75 of file uniform_sampling.h.

◆ Ptr

template<typename PointT >
using pcl::UniformSampling< PointT >::Ptr = shared_ptr<UniformSampling<PointT> >

Definition at line 74 of file uniform_sampling.h.

Constructor & Destructor Documentation

◆ UniformSampling()

template<typename PointT >
PCL_MAKE_ALIGNED_OPERATOR_NEW pcl::UniformSampling< PointT >::UniformSampling ( bool  extract_removed_indices = false)
inline

Empty constructor.

Definition at line 80 of file uniform_sampling.h.

References pcl::Filter< PointT >::filter_name_.

◆ ~UniformSampling()

template<typename PointT >
pcl::UniformSampling< PointT >::~UniformSampling ( )
inlineoverride

Destructor.

Definition at line 94 of file uniform_sampling.h.

References pcl::UniformSampling< PointT >::leaves_.

Member Function Documentation

◆ applyFilter()

template<typename PointT >
void pcl::UniformSampling< PointT >::applyFilter ( Indices indices)
overrideprotectedvirtual

Filtered results are indexed by an indices array.

Parameters
[out]indicesThe resultant indices.

Implements pcl::FilterIndices< PointT >.

Definition at line 47 of file uniform_sampling.hpp.

References pcl::UniformSampling< PointT >::Leaf::count, pcl::UniformSampling< PointT >::Leaf::idx, and pcl::isXYZFinite().

◆ getMinimumPointsNumberPerVoxel()

template<typename PointT >
unsigned int pcl::UniformSampling< PointT >::getMinimumPointsNumberPerVoxel ( ) const
inline

Return the minimum number of points required for a voxel to be used.

Definition at line 123 of file uniform_sampling.h.

References pcl::UniformSampling< PointT >::min_points_per_voxel_.

◆ setMinimumPointsNumberPerVoxel()

template<typename PointT >
void pcl::UniformSampling< PointT >::setMinimumPointsNumberPerVoxel ( unsigned int  min_points_per_voxel)
inline

Set the minimum number of points required for a voxel to be used.

Parameters
[in]min_points_per_voxelthe minimum number of points for required for a voxel to be used

Definition at line 118 of file uniform_sampling.h.

References pcl::UniformSampling< PointT >::min_points_per_voxel_.

◆ setRadiusSearch()

template<typename PointT >
virtual void pcl::UniformSampling< PointT >::setRadiusSearch ( double  radius)
inlinevirtual

Set the 3D grid leaf size.

Parameters
radiusthe 3D grid leaf size

Definition at line 103 of file uniform_sampling.h.

References pcl::UniformSampling< PointT >::inverse_leaf_size_, pcl::UniformSampling< PointT >::leaf_size_, and pcl::UniformSampling< PointT >::search_radius_.

Member Data Documentation

◆ div_b_

template<typename PointT >
Eigen::Vector4i pcl::UniformSampling< PointT >::div_b_
protected

Definition at line 145 of file uniform_sampling.h.

◆ divb_mul_

template<typename PointT >
Eigen::Vector4i pcl::UniformSampling< PointT >::divb_mul_
protected

Definition at line 145 of file uniform_sampling.h.

◆ inverse_leaf_size_

template<typename PointT >
Eigen::Array4f pcl::UniformSampling< PointT >::inverse_leaf_size_
protected

Internal leaf sizes stored as 1/leaf_size_ for efficiency reasons.

Definition at line 142 of file uniform_sampling.h.

Referenced by pcl::UniformSampling< PointT >::setRadiusSearch().

◆ leaf_size_

template<typename PointT >
Eigen::Vector4f pcl::UniformSampling< PointT >::leaf_size_
protected

The size of a leaf.

Definition at line 139 of file uniform_sampling.h.

Referenced by pcl::UniformSampling< PointT >::setRadiusSearch().

◆ leaves_

template<typename PointT >
std::unordered_map<std::size_t, Leaf> pcl::UniformSampling< PointT >::leaves_
protected

The 3D grid leaves.

Definition at line 136 of file uniform_sampling.h.

Referenced by pcl::UniformSampling< PointT >::~UniformSampling().

◆ max_b_

template<typename PointT >
Eigen::Vector4i pcl::UniformSampling< PointT >::max_b_
protected

Definition at line 145 of file uniform_sampling.h.

◆ min_b_

template<typename PointT >
Eigen::Vector4i pcl::UniformSampling< PointT >::min_b_
protected

The minimum and maximum bin coordinates, the number of divisions, and the division multiplier.

Definition at line 145 of file uniform_sampling.h.

◆ min_points_per_voxel_

template<typename PointT >
unsigned int pcl::UniformSampling< PointT >::min_points_per_voxel_ {0}
protected

◆ search_radius_

template<typename PointT >
double pcl::UniformSampling< PointT >::search_radius_ {0.0}
protected

The nearest neighbors search radius for each point.

Definition at line 148 of file uniform_sampling.h.

Referenced by pcl::UniformSampling< PointT >::setRadiusSearch().


The documentation for this class was generated from the following files: