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

NormalEstimation estimates local surface properties (surface normals and curvatures)at each 3D point. More...

#include <pcl/features/normal_3d.h>

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

Public Types

using Ptr = shared_ptr< NormalEstimation< PointInT, PointOutT > >
 
using ConstPtr = shared_ptr< const NormalEstimation< PointInT, PointOutT > >
 
using PointCloudOut = typename Feature< PointInT, PointOutT >::PointCloudOut
 
using PointCloudConstPtr = typename Feature< PointInT, PointOutT >::PointCloudConstPtr
 
- 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

 NormalEstimation ()
 Empty constructor. More...
 
 ~NormalEstimation () override=default
 Empty destructor. More...
 
bool computePointNormal (const pcl::PointCloud< PointInT > &cloud, const pcl::Indices &indices, Eigen::Vector4f &plane_parameters, float &curvature)
 Compute the Least-Squares plane fit for a given set of points, using their indices, and return the estimated plane parameters together with the surface curvature. More...
 
bool computePointNormal (const pcl::PointCloud< PointInT > &cloud, const pcl::Indices &indices, float &nx, float &ny, float &nz, float &curvature)
 Compute the Least-Squares plane fit for a given set of points, using their indices, and return the estimated plane parameters together with the surface curvature. More...
 
void setInputCloud (const PointCloudConstPtr &cloud) override
 Provide a pointer to the input dataset. 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 useSensorOriginAsViewPoint ()
 sets whether the sensor origin or a user given viewpoint should be used. 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

void computeFeature (PointCloudOut &output) override
 Estimate normals for all points given in <setInputCloud (), setIndices ()> using the surface in setSearchSurface () and the spatial locator in setSearchMethod () 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 initCompute ()
 This method should get called before starting the actual computation. 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

float vpx_ {0.0f}
 Values describing the viewpoint ("pinhole" camera model assumed). More...
 
float vpy_ {0.0f}
 
float vpz_ {0.0f}
 
EIGEN_ALIGN16 Eigen::Matrix3f covariance_matrix_
 Placeholder for the 3x3 covariance matrix at each surface patch. More...
 
Eigen::Vector4f xyz_centroid_
 16-bytes aligned placeholder for the XYZ centroid of a surface patch. More...
 
bool use_sensor_origin_ {true}
 whether the sensor origin of the input cloud or a user given viewpoint should be used. 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 PointOutT>
class pcl::NormalEstimation< PointInT, PointOutT >

NormalEstimation estimates local surface properties (surface normals and curvatures)at each 3D point.

If PointOutT is specified as pcl::Normal, the normal is stored in the first 3 components (0-2), and the curvature is stored in component 3.

Note
The code is stateful as we do not expect this class to be multicore parallelized. Please look at NormalEstimationOMP for a parallel implementation.
Author
Radu B. Rusu

Definition at line 243 of file normal_3d.h.

Member Typedef Documentation

◆ ConstPtr

template<typename PointInT , typename PointOutT >
using pcl::NormalEstimation< PointInT, PointOutT >::ConstPtr = shared_ptr<const NormalEstimation<PointInT, PointOutT> >

Definition at line 247 of file normal_3d.h.

◆ PointCloudConstPtr

template<typename PointInT , typename PointOutT >
using pcl::NormalEstimation< PointInT, PointOutT >::PointCloudConstPtr = typename Feature<PointInT, PointOutT>::PointCloudConstPtr

Definition at line 258 of file normal_3d.h.

◆ PointCloudOut

template<typename PointInT , typename PointOutT >
using pcl::NormalEstimation< PointInT, PointOutT >::PointCloudOut = typename Feature<PointInT, PointOutT>::PointCloudOut

Definition at line 257 of file normal_3d.h.

◆ Ptr

template<typename PointInT , typename PointOutT >
using pcl::NormalEstimation< PointInT, PointOutT >::Ptr = shared_ptr<NormalEstimation<PointInT, PointOutT> >

Definition at line 246 of file normal_3d.h.

Constructor & Destructor Documentation

◆ NormalEstimation()

template<typename PointInT , typename PointOutT >
pcl::NormalEstimation< PointInT, PointOutT >::NormalEstimation ( )
inline

Empty constructor.

Definition at line 261 of file normal_3d.h.

References pcl::Feature< PointInT, PointOutT >::feature_name_.

◆ ~NormalEstimation()

template<typename PointInT , typename PointOutT >
pcl::NormalEstimation< PointInT, PointOutT >::~NormalEstimation ( )
overridedefault

Empty destructor.

Member Function Documentation

◆ computeFeature()

template<typename PointInT , typename PointOutT >
void pcl::NormalEstimation< PointInT, PointOutT >::computeFeature ( PointCloudOut output)
overrideprotectedvirtual

Estimate normals for all points given in <setInputCloud (), setIndices ()> using the surface in setSearchSurface () and the spatial locator in setSearchMethod ()

Note
In situations where not enough neighbors are found, the normal and curvature values are set to NaN.
Parameters
outputthe resultant point cloud model dataset that contains surface normals and curvatures

Implements pcl::Feature< PointInT, PointOutT >.

Definition at line 48 of file normal_3d.hpp.

References pcl::computePointNormal(), pcl::flipNormalTowardsViewpoint(), pcl::PointCloud< PointT >::is_dense, and pcl::isFinite().

◆ computePointNormal() [1/2]

template<typename PointInT , typename PointOutT >
bool pcl::NormalEstimation< PointInT, PointOutT >::computePointNormal ( const pcl::PointCloud< PointInT > &  cloud,
const pcl::Indices indices,
Eigen::Vector4f &  plane_parameters,
float &  curvature 
)
inline

Compute the Least-Squares plane fit for a given set of points, using their indices, and return the estimated plane parameters together with the surface curvature.

Parameters
cloudthe input point cloud
indicesthe point cloud indices that need to be used
plane_parametersthe plane parameters as: a, b, c, d (ax + by + cz + d = 0)
curvaturethe estimated surface curvature as a measure of

\[ \lambda_0 / (\lambda_0 + \lambda_1 + \lambda_2) \]

Definition at line 280 of file normal_3d.h.

References pcl::computeMeanAndCovarianceMatrix(), pcl::NormalEstimation< PointInT, PointOutT >::covariance_matrix_, pcl::solvePlaneParameters(), and pcl::NormalEstimation< PointInT, PointOutT >::xyz_centroid_.

◆ computePointNormal() [2/2]

template<typename PointInT , typename PointOutT >
bool pcl::NormalEstimation< PointInT, PointOutT >::computePointNormal ( const pcl::PointCloud< PointInT > &  cloud,
const pcl::Indices indices,
float &  nx,
float &  ny,
float &  nz,
float &  curvature 
)
inline

Compute the Least-Squares plane fit for a given set of points, using their indices, and return the estimated plane parameters together with the surface curvature.

Parameters
cloudthe input point cloud
indicesthe point cloud indices that need to be used
nxthe resultant X component of the plane normal
nythe resultant Y component of the plane normal
nzthe resultant Z component of the plane normal
curvaturethe estimated surface curvature as a measure of

\[ \lambda_0 / (\lambda_0 + \lambda_1 + \lambda_2) \]

Definition at line 309 of file normal_3d.h.

References pcl::computeMeanAndCovarianceMatrix(), pcl::NormalEstimation< PointInT, PointOutT >::covariance_matrix_, pcl::solvePlaneParameters(), and pcl::NormalEstimation< PointInT, PointOutT >::xyz_centroid_.

◆ getViewPoint()

template<typename PointInT , typename PointOutT >
void pcl::NormalEstimation< PointInT, PointOutT >::getViewPoint ( float &  vpx,
float &  vpy,
float &  vpz 
)
inline

Get the viewpoint.

Parameters
[out]vpxx-coordinate of the view point
[out]vpyy-coordinate of the view point
[out]vpzz-coordinate of the view point
Note
this method returns the currently used viewpoint for normal flipping. If the viewpoint is set manually using the setViewPoint method, this method will return the set view point coordinates. If an input cloud is set, it will return the sensor origin otherwise it will return the origin (0, 0, 0)

Definition at line 362 of file normal_3d.h.

References pcl::NormalEstimation< PointInT, PointOutT >::vpx_, pcl::NormalEstimation< PointInT, PointOutT >::vpy_, and pcl::NormalEstimation< PointInT, PointOutT >::vpz_.

◆ setInputCloud()

template<typename PointInT , typename PointOutT >
void pcl::NormalEstimation< PointInT, PointOutT >::setInputCloud ( const PointCloudConstPtr cloud)
inlineoverride

◆ setViewPoint()

template<typename PointInT , typename PointOutT >
void pcl::NormalEstimation< PointInT, PointOutT >::setViewPoint ( float  vpx,
float  vpy,
float  vpz 
)
inline

Set the viewpoint.

Parameters
vpxthe X coordinate of the viewpoint
vpythe Y coordinate of the viewpoint
vpzthe Z coordinate of the viewpoint

Definition at line 345 of file normal_3d.h.

References pcl::NormalEstimation< PointInT, PointOutT >::use_sensor_origin_, pcl::NormalEstimation< PointInT, PointOutT >::vpx_, pcl::NormalEstimation< PointInT, PointOutT >::vpy_, and pcl::NormalEstimation< PointInT, PointOutT >::vpz_.

◆ useSensorOriginAsViewPoint()

template<typename PointInT , typename PointOutT >
void pcl::NormalEstimation< PointInT, PointOutT >::useSensorOriginAsViewPoint ( )
inline

sets whether the sensor origin or a user given viewpoint should be used.

After this method, the normal estimation method uses the sensor origin of the input cloud. to use a user defined view point, use the method setViewPoint

Definition at line 374 of file normal_3d.h.

References pcl::PCLBase< PointInT >::input_, pcl::NormalEstimation< PointInT, PointOutT >::use_sensor_origin_, pcl::NormalEstimation< PointInT, PointOutT >::vpx_, pcl::NormalEstimation< PointInT, PointOutT >::vpy_, and pcl::NormalEstimation< PointInT, PointOutT >::vpz_.

Member Data Documentation

◆ covariance_matrix_

template<typename PointInT , typename PointOutT >
EIGEN_ALIGN16 Eigen::Matrix3f pcl::NormalEstimation< PointInT, PointOutT >::covariance_matrix_
protected

Placeholder for the 3x3 covariance matrix at each surface patch.

Definition at line 405 of file normal_3d.h.

Referenced by pcl::NormalEstimation< PointInT, PointOutT >::computePointNormal().

◆ use_sensor_origin_

template<typename PointInT , typename PointOutT >
bool pcl::NormalEstimation< PointInT, PointOutT >::use_sensor_origin_ {true}
protected

whether the sensor origin of the input cloud or a user given viewpoint should be used.

Definition at line 411 of file normal_3d.h.

Referenced by pcl::NormalEstimation< PointInT, PointOutT >::setInputCloud(), pcl::NormalEstimation< PointInT, PointOutT >::setViewPoint(), and pcl::NormalEstimation< PointInT, PointOutT >::useSensorOriginAsViewPoint().

◆ vpx_

template<typename PointInT , typename PointOutT >
float pcl::NormalEstimation< PointInT, PointOutT >::vpx_ {0.0f}
protected

Values describing the viewpoint ("pinhole" camera model assumed).

For per point viewpoints, inherit from NormalEstimation and provide your own computeFeature (). By default, the viewpoint is set to 0,0,0.

Definition at line 402 of file normal_3d.h.

Referenced by pcl::NormalEstimation< PointInT, PointOutT >::getViewPoint(), pcl::NormalEstimation< PointInT, PointOutT >::setInputCloud(), pcl::NormalEstimation< PointInT, PointOutT >::setViewPoint(), and pcl::NormalEstimation< PointInT, PointOutT >::useSensorOriginAsViewPoint().

◆ vpy_

template<typename PointInT , typename PointOutT >
float pcl::NormalEstimation< PointInT, PointOutT >::vpy_ {0.0f}
protected

◆ vpz_

template<typename PointInT , typename PointOutT >
float pcl::NormalEstimation< PointInT, PointOutT >::vpz_ {0.0f}
protected

◆ xyz_centroid_

template<typename PointInT , typename PointOutT >
Eigen::Vector4f pcl::NormalEstimation< PointInT, PointOutT >::xyz_centroid_
protected

16-bytes aligned placeholder for the XYZ centroid of a surface patch.

Definition at line 408 of file normal_3d.h.

Referenced by pcl::NormalEstimation< PointInT, PointOutT >::computePointNormal().


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