Point Cloud Library (PCL)  1.14.1-dev
List of all members | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
pcl::VFHEstimation< PointInT, PointNT, PointOutT > Class Template Reference

VFHEstimation estimates the Viewpoint Feature Histogram (VFH) descriptor for a given point cloud dataset containing points and normals. More...

#include <pcl/features/vfh.h>

+ Inheritance diagram for pcl::VFHEstimation< PointInT, PointNT, PointOutT >:
+ Collaboration diagram for pcl::VFHEstimation< PointInT, PointNT, PointOutT >:

Public Types

using PointCloudOut = typename Feature< PointInT, PointOutT >::PointCloudOut
 
using Ptr = shared_ptr< VFHEstimation< PointInT, PointNT, PointOutT > >
 
using ConstPtr = shared_ptr< const VFHEstimation< PointInT, PointNT, PointOutT > >
 
- Public Types inherited from pcl::FeatureFromNormals< PointInT, PointNT, pcl::VFHSignature308 >
using PointCloudN = pcl::PointCloud< PointNT >
 
using PointCloudNPtr = typename PointCloudN::Ptr
 
using PointCloudNConstPtr = typename PointCloudN::ConstPtr
 
using Ptr = shared_ptr< FeatureFromNormals< PointInT, PointNT, pcl::VFHSignature308 > >
 
using ConstPtr = shared_ptr< const FeatureFromNormals< PointInT, PointNT, pcl::VFHSignature308 > >
 
- Public Types inherited from pcl::Feature< PointInT, PointOutT >
using BaseClass = PCLBase< PointInT >
 
using Ptr = shared_ptr< Feature< PointInT, PointOutT > >
 
using ConstPtr = shared_ptr< const Feature< PointInT, PointOutT > >
 
using KdTree = pcl::search::Search< PointInT >
 
using KdTreePtr = typename KdTree::Ptr
 
using PointCloudIn = pcl::PointCloud< PointInT >
 
using PointCloudInPtr = typename PointCloudIn::Ptr
 
using PointCloudInConstPtr = typename PointCloudIn::ConstPtr
 
using PointCloudOut = pcl::PointCloud< PointOutT >
 
using SearchMethod = std::function< int(std::size_t, double, pcl::Indices &, std::vector< float > &)>
 
using SearchMethodSurface = std::function< int(const PointCloudIn &cloud, std::size_t index, double, pcl::Indices &, std::vector< float > &)>
 
- Public Types inherited from pcl::PCLBase< PointInT >
using PointCloud = pcl::PointCloud< PointInT >
 
using PointCloudPtr = typename PointCloud::Ptr
 
using PointCloudConstPtr = typename PointCloud::ConstPtr
 
using PointIndicesPtr = PointIndices::Ptr
 
using PointIndicesConstPtr = PointIndices::ConstPtr
 

Public Member Functions

 VFHEstimation ()
 Empty constructor. More...
 
void computePointSPFHSignature (const Eigen::Vector4f &centroid_p, const Eigen::Vector4f &centroid_n, const pcl::PointCloud< PointInT > &cloud, const pcl::PointCloud< PointNT > &normals, const pcl::Indices &indices)
 Estimate the SPFH (Simple Point Feature Histograms) signatures of the angular (f1, f2, f3) and distance (f4) features for a given point from its neighborhood. More...
 
void setViewPoint (float vpx, float vpy, float vpz)
 Set the viewpoint. More...
 
void getViewPoint (float &vpx, float &vpy, float &vpz)
 Get the viewpoint. More...
 
void setUseGivenNormal (bool use)
 Set use_given_normal_. More...
 
void setNormalToUse (const Eigen::Vector3f &normal)
 Set the normal to use. More...
 
void setUseGivenCentroid (bool use)
 Set use_given_centroid_. More...
 
void setCentroidToUse (const Eigen::Vector3f &centroid)
 Set centroid_to_use_. More...
 
void setNormalizeBins (bool normalize)
 set normalize_bins_ More...
 
void setNormalizeDistance (bool normalize)
 set normalize_distances_ More...
 
void setFillSizeComponent (bool fill_size)
 set size_component_ More...
 
void compute (PointCloudOut &output)
 Overloaded computed method from pcl::Feature. More...
 
- Public Member Functions inherited from pcl::FeatureFromNormals< PointInT, PointNT, pcl::VFHSignature308 >
 FeatureFromNormals ()
 Empty constructor. More...
 
void setInputNormals (const PointCloudNConstPtr &normals)
 Provide a pointer to the input dataset that contains the point normals of the XYZ dataset. More...
 
PointCloudNConstPtr getInputNormals () const
 Get a pointer to the normals of the input XYZ point cloud dataset. More...
 
- Public Member Functions inherited from pcl::Feature< PointInT, PointOutT >
 Feature ()
 Empty constructor. More...
 
void setSearchSurface (const PointCloudInConstPtr &cloud)
 Provide a pointer to a dataset to add additional information to estimate the features for every point in the input dataset. More...
 
PointCloudInConstPtr getSearchSurface () const
 Get a pointer to the surface point cloud dataset. More...
 
void setSearchMethod (const KdTreePtr &tree)
 Provide a pointer to the search object. More...
 
KdTreePtr getSearchMethod () const
 Get a pointer to the search method used. More...
 
double getSearchParameter () const
 Get the internal search parameter. More...
 
void setKSearch (int k)
 Set the number of k nearest neighbors to use for the feature estimation. More...
 
int getKSearch () const
 get the number of k nearest neighbors used for the feature estimation. More...
 
void setRadiusSearch (double radius)
 Set the sphere radius that is to be used for determining the nearest neighbors used for the feature estimation. More...
 
double getRadiusSearch () const
 Get the sphere radius used for determining the neighbors. More...
 
void compute (PointCloudOut &output)
 Base method for feature estimation for all points given in <setInputCloud (), setIndices ()> using the surface in setSearchSurface () and the spatial locator in setSearchMethod () More...
 
- Public Member Functions inherited from pcl::PCLBase< PointInT >
 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 PointInT & operator[] (std::size_t pos) const
 Override PointCloud operator[] to shorten code. More...
 

Protected Member Functions

bool initCompute () override
 This method should get called before starting the actual computation. More...
 
- Protected Member Functions inherited from pcl::Feature< PointInT, PointOutT >
const std::string & getClassName () const
 Get a string representation of the name of this class. More...
 
virtual bool deinitCompute ()
 This method should get called after ending the actual computation. More...
 
int searchForNeighbors (std::size_t index, double parameter, pcl::Indices &indices, std::vector< float > &distances) const
 Search for k-nearest neighbors using the spatial locator from setSearchmethod, and the given surface from setSearchSurface. More...
 
int searchForNeighbors (const PointCloudIn &cloud, std::size_t index, double parameter, pcl::Indices &indices, std::vector< float > &distances) const
 Search for k-nearest neighbors using the spatial locator from setSearchmethod, and the given surface from setSearchSurface. More...
 
- Protected Member Functions inherited from pcl::PCLBase< PointInT >
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::array< Eigen::VectorXf, 4 > hist_f_
 Placeholder for the f1 histogram. More...
 
Eigen::VectorXf hist_vp_
 Placeholder for the vp histogram. More...
 
Eigen::Vector4f normal_to_use_
 Normal to be used to computed VFH. More...
 
Eigen::Vector4f centroid_to_use_
 Centroid to be used to computed VFH. More...
 
bool use_given_normal_ {false}
 Use the normal_to_use_. More...
 
bool use_given_centroid_ {false}
 Use the centroid_to_use_. More...
 
bool normalize_bins_ {true}
 Normalize bins by the number the total number of points. More...
 
bool normalize_distances_ {false}
 Normalize the shape distribution component of VFH. More...
 
bool size_component_ {false}
 Activate or deactivate the size component of VFH. More...
 
- Protected Attributes inherited from pcl::FeatureFromNormals< PointInT, PointNT, pcl::VFHSignature308 >
PointCloudNConstPtr normals_
 A pointer to the input dataset that contains the point normals of the XYZ dataset. More...
 
- Protected Attributes inherited from pcl::Feature< PointInT, PointOutT >
std::string feature_name_
 The feature name. More...
 
SearchMethodSurface search_method_surface_
 The search method template for points. More...
 
PointCloudInConstPtr surface_
 An input point cloud describing the surface that is to be used for nearest neighbors estimation. More...
 
KdTreePtr tree_
 A pointer to the spatial search object. More...
 
double search_parameter_
 The actual search parameter (from either search_radius_ or k_). More...
 
double search_radius_
 The nearest neighbors search radius for each point. More...
 
int k_
 The number of K nearest neighbors to use for each point. More...
 
bool fake_surface_
 If no surface is given, we use the input PointCloud as the surface. More...
 
- Protected Attributes inherited from pcl::PCLBase< PointInT >
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 PointInT, typename PointNT, typename PointOutT = pcl::VFHSignature308>
class pcl::VFHEstimation< PointInT, PointNT, PointOutT >

VFHEstimation estimates the Viewpoint Feature Histogram (VFH) descriptor for a given point cloud dataset containing points and normals.

The default VFH implementation uses 45 binning subdivisions for each of the three extended FPFH values, plus another 45 binning subdivisions for the distances between each point and the centroid and 128 binning subdivisions for the viewpoint component, which results in a 308-byte array of float values. These are stored in a pcl::VFHSignature308 point type. A major difference between the PFH/FPFH descriptors and VFH, is that for a given point cloud dataset, only a single VFH descriptor will be estimated (vfhs->size() should be 1), while the resultant PFH/FPFH data will have the same number of entries as the number of points in the cloud.

Note
If you use this code in any academic work, please cite:
Note
The code is stateful as we do not expect this class to be multicore parallelized. Please look at FPFHEstimationOMP for an example of a parallel implementation of the FPFH (Fast Point Feature Histogram).
Author
Radu B. Rusu

Definition at line 72 of file vfh.h.

Member Typedef Documentation

◆ ConstPtr

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
using pcl::VFHEstimation< PointInT, PointNT, PointOutT >::ConstPtr = shared_ptr<const VFHEstimation<PointInT, PointNT, PointOutT> >

Definition at line 86 of file vfh.h.

◆ PointCloudOut

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
using pcl::VFHEstimation< PointInT, PointNT, PointOutT >::PointCloudOut = typename Feature<PointInT, PointOutT>::PointCloudOut

Definition at line 84 of file vfh.h.

◆ Ptr

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
using pcl::VFHEstimation< PointInT, PointNT, PointOutT >::Ptr = shared_ptr<VFHEstimation<PointInT, PointNT, PointOutT> >

Definition at line 85 of file vfh.h.

Constructor & Destructor Documentation

◆ VFHEstimation()

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
pcl::VFHEstimation< PointInT, PointNT, PointOutT >::VFHEstimation ( )
inline

Empty constructor.

Definition at line 90 of file vfh.h.

Member Function Documentation

◆ compute()

template<typename PointInT , typename PointNT , typename PointOutT >
void pcl::VFHEstimation< PointInT, PointNT, PointOutT >::compute ( PointCloudOut output)

Overloaded computed method from pcl::Feature.

Parameters
[out]outputthe resultant point cloud model dataset containing the estimated features

Definition at line 65 of file vfh.hpp.

References pcl::PointCloud< PointT >::clear(), pcl::PointCloud< PointT >::header, pcl::PointCloud< PointT >::height, pcl::PointCloud< PointT >::is_dense, pcl::PointCloud< PointT >::resize(), and pcl::PointCloud< PointT >::width.

◆ computePointSPFHSignature()

template<typename PointInT , typename PointNT , typename PointOutT >
void pcl::VFHEstimation< PointInT, PointNT, PointOutT >::computePointSPFHSignature ( const Eigen::Vector4f &  centroid_p,
const Eigen::Vector4f &  centroid_n,
const pcl::PointCloud< PointInT > &  cloud,
const pcl::PointCloud< PointNT > &  normals,
const pcl::Indices indices 
)

Estimate the SPFH (Simple Point Feature Histograms) signatures of the angular (f1, f2, f3) and distance (f4) features for a given point from its neighborhood.

Parameters
[in]centroid_pthe centroid point
[in]centroid_nthe centroid normal
[in]cloudthe dataset containing the XYZ Cartesian coordinates of the two points
[in]normalsthe dataset containing the surface normals at each point in cloud
[in]indicesthe k-neighborhood point indices in the dataset

Definition at line 92 of file vfh.hpp.

References pcl::computePairFeatures(), pcl::getMaxDistance(), M_PI, and pcl_round().

◆ getViewPoint()

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
void pcl::VFHEstimation< PointInT, PointNT, PointOutT >::getViewPoint ( float &  vpx,
float &  vpy,
float &  vpz 
)
inline

Get the viewpoint.

Definition at line 131 of file vfh.h.

◆ initCompute()

template<typename PointInT , typename PointNT , typename PointOutT >
bool pcl::VFHEstimation< PointInT, PointNT, PointOutT >::initCompute
overrideprotectedvirtual

This method should get called before starting the actual computation.

Reimplemented from pcl::FeatureFromNormals< PointInT, PointNT, pcl::VFHSignature308 >.

Definition at line 51 of file vfh.hpp.

◆ setCentroidToUse()

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
void pcl::VFHEstimation< PointInT, PointNT, PointOutT >::setCentroidToUse ( const Eigen::Vector3f &  centroid)
inline

Set centroid_to_use_.

Parameters
[in]centroidCentroid to be used in the VFH computation. It is used to compute the distances from all points to this centroid.

Definition at line 171 of file vfh.h.

References pcl::VFHEstimation< PointInT, PointNT, PointOutT >::centroid_to_use_.

◆ setFillSizeComponent()

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
void pcl::VFHEstimation< PointInT, PointNT, PointOutT >::setFillSizeComponent ( bool  fill_size)
inline

set size_component_

Parameters
[in]fill_sizeTrue if the 4th component of VFH (shape distribution component) needs to be filled. Otherwise, it is set to zero.

Definition at line 200 of file vfh.h.

References pcl::VFHEstimation< PointInT, PointNT, PointOutT >::size_component_.

◆ setNormalizeBins()

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
void pcl::VFHEstimation< PointInT, PointNT, PointOutT >::setNormalizeBins ( bool  normalize)
inline

set normalize_bins_

Parameters
[in]normalizeIf true, the VFH bins are normalized using the total number of points

Definition at line 180 of file vfh.h.

References pcl::VFHEstimation< PointInT, PointNT, PointOutT >::normalize_bins_.

◆ setNormalizeDistance()

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
void pcl::VFHEstimation< PointInT, PointNT, PointOutT >::setNormalizeDistance ( bool  normalize)
inline

set normalize_distances_

Parameters
[in]normalizeIf true, the 4th component of VFH (shape distribution component) get normalized by the maximum size between the centroid and the point cloud

Definition at line 190 of file vfh.h.

References pcl::VFHEstimation< PointInT, PointNT, PointOutT >::normalize_distances_.

◆ setNormalToUse()

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
void pcl::VFHEstimation< PointInT, PointNT, PointOutT >::setNormalToUse ( const Eigen::Vector3f &  normal)
inline

Set the normal to use.

Parameters
[in]normalSets the normal to be used in the VFH computation. It is is used to build the Darboux Coordinate system.

Definition at line 152 of file vfh.h.

References pcl::VFHEstimation< PointInT, PointNT, PointOutT >::normal_to_use_.

◆ setUseGivenCentroid()

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
void pcl::VFHEstimation< PointInT, PointNT, PointOutT >::setUseGivenCentroid ( bool  use)
inline

Set use_given_centroid_.

Parameters
[in]useSet to true if you want to use the centroid passed through setCentroidToUse(centroid)

Definition at line 161 of file vfh.h.

References pcl::VFHEstimation< PointInT, PointNT, PointOutT >::use_given_centroid_.

◆ setUseGivenNormal()

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
void pcl::VFHEstimation< PointInT, PointNT, PointOutT >::setUseGivenNormal ( bool  use)
inline

Set use_given_normal_.

Parameters
[in]useSet to true if you want to use the normal passed to setNormalUse(normal)

Definition at line 142 of file vfh.h.

References pcl::VFHEstimation< PointInT, PointNT, PointOutT >::use_given_normal_.

◆ setViewPoint()

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
void pcl::VFHEstimation< PointInT, PointNT, PointOutT >::setViewPoint ( float  vpx,
float  vpy,
float  vpz 
)
inline

Set the viewpoint.

Parameters
[in]vpxthe X coordinate of the viewpoint
[in]vpythe Y coordinate of the viewpoint
[in]vpzthe Z coordinate of the viewpoint

Definition at line 122 of file vfh.h.

Member Data Documentation

◆ centroid_to_use_

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
Eigen::Vector4f pcl::VFHEstimation< PointInT, PointNT, PointOutT >::centroid_to_use_
protected

Centroid to be used to computed VFH.

Default, the centroid of the whole point cloud

Definition at line 243 of file vfh.h.

Referenced by pcl::VFHEstimation< PointInT, PointNT, PointOutT >::setCentroidToUse().

◆ hist_f_

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
std::array<Eigen::VectorXf, 4> pcl::VFHEstimation< PointInT, PointNT, PointOutT >::hist_f_
protected

Placeholder for the f1 histogram.

Definition at line 236 of file vfh.h.

◆ hist_vp_

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
Eigen::VectorXf pcl::VFHEstimation< PointInT, PointNT, PointOutT >::hist_vp_
protected

Placeholder for the vp histogram.

Definition at line 238 of file vfh.h.

◆ normal_to_use_

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
Eigen::Vector4f pcl::VFHEstimation< PointInT, PointNT, PointOutT >::normal_to_use_
protected

Normal to be used to computed VFH.

Default, the average normal of the whole point cloud

Definition at line 241 of file vfh.h.

Referenced by pcl::VFHEstimation< PointInT, PointNT, PointOutT >::setNormalToUse().

◆ normalize_bins_

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
bool pcl::VFHEstimation< PointInT, PointNT, PointOutT >::normalize_bins_ {true}
protected

Normalize bins by the number the total number of points.

Definition at line 252 of file vfh.h.

Referenced by pcl::VFHEstimation< PointInT, PointNT, PointOutT >::setNormalizeBins().

◆ normalize_distances_

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
bool pcl::VFHEstimation< PointInT, PointNT, PointOutT >::normalize_distances_ {false}
protected

Normalize the shape distribution component of VFH.

Definition at line 254 of file vfh.h.

Referenced by pcl::VFHEstimation< PointInT, PointNT, PointOutT >::setNormalizeDistance().

◆ size_component_

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
bool pcl::VFHEstimation< PointInT, PointNT, PointOutT >::size_component_ {false}
protected

Activate or deactivate the size component of VFH.

Definition at line 256 of file vfh.h.

Referenced by pcl::VFHEstimation< PointInT, PointNT, PointOutT >::setFillSizeComponent().

◆ use_given_centroid_

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
bool pcl::VFHEstimation< PointInT, PointNT, PointOutT >::use_given_centroid_ {false}
protected

Use the centroid_to_use_.

Definition at line 250 of file vfh.h.

Referenced by pcl::VFHEstimation< PointInT, PointNT, PointOutT >::setUseGivenCentroid().

◆ use_given_normal_

template<typename PointInT , typename PointNT , typename PointOutT = pcl::VFHSignature308>
bool pcl::VFHEstimation< PointInT, PointNT, PointOutT >::use_given_normal_ {false}
protected

Use the normal_to_use_.

Definition at line 248 of file vfh.h.

Referenced by pcl::VFHEstimation< PointInT, PointNT, PointOutT >::setUseGivenNormal().


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