Point Cloud Library (PCL)  1.14.1-dev
List of all members | Public Member Functions | Protected Member Functions
pcl::NormalRefinement< NormalT > Class Template Reference

Normal vector refinement class More...

#include <pcl/filters/normal_refinement.h>

+ Inheritance diagram for pcl::NormalRefinement< NormalT >:
+ Collaboration diagram for pcl::NormalRefinement< NormalT >:

Public Member Functions

 NormalRefinement ()
 Empty constructor, sets default convergence parameters. More...
 
 NormalRefinement (const std::vector< Indices > &k_indices, const std::vector< std::vector< float > > &k_sqr_distances)
 Constructor for setting correspondences, sets default convergence parameters. More...
 
void setCorrespondences (const std::vector< Indices > &k_indices, const std::vector< std::vector< float > > &k_sqr_distances)
 Set correspondences calculated from nearest neighbor search. More...
 
void getCorrespondences (std::vector< Indices > &k_indices, std::vector< std::vector< float > > &k_sqr_distances)
 Get correspondences (copy) More...
 
void setMaxIterations (unsigned int max_iterations)
 Set maximum iterations. More...
 
unsigned int getMaxIterations ()
 Get maximum iterations. More...
 
void setConvergenceThreshold (float convergence_threshold)
 Set convergence threshold. More...
 
float getConvergenceThreshold ()
 Get convergence threshold. More...
 
- Public Member Functions inherited from pcl::Filter< NormalT >
 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 (PointCloud &output) override
 Filter a Point Cloud. More...
 
- Protected Member Functions inherited from pcl::Filter< NormalT >
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...
 

Additional Inherited Members

- Public Types inherited from pcl::Filter< NormalT >
using Ptr = shared_ptr< Filter< NormalT > >
 
using ConstPtr = shared_ptr< const Filter< NormalT > >
 
using PointCloud = pcl::PointCloud< NormalT >
 
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
 
- Protected Attributes inherited from pcl::Filter< NormalT >
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 NormalT>
class pcl::NormalRefinement< NormalT >

Normal vector refinement class

This class refines a set of already estimated normals by iteratively updating each normal to the (weighted) mean of all normals in its neighborhood. The intention is that you reuse the same point correspondences as used when estimating the original normals in order to avoid repeating a nearest neighbor search.

Note
This class avoids points for which a NaN is encountered in the neighborhood. In the special case where a point has only NaNs in its neighborhood, the resultant refined normal will be set to zero, i.e. this class only produces finite normals.

Usage example:

// Input point cloud
// Fill cloud...
// Estimated and refined normals
pcl::PointCloud<NormalT> normals_refined;
// Search parameters
const int k = 5;
std::vector<Indices > k_indices;
std::vector<std::vector<float> > k_sqr_distances;
// Run search
search.setInputCloud (cloud.makeShared ());
search.nearestKSearch (cloud, Indices (), k, k_indices, k_sqr_distances);
// Use search results for normal estimation
for (unsigned int i = 0; i < cloud.size (); ++i)
{
NormalT normal;
ne.computePointNormal (cloud, k_indices[i]
normal.normal_x, normal.normal_y, normal.normal_z, normal.curvature);
normal.normal_x, normal.normal_y, normal.normal_z);
normals.push_back (normal);
}
// Run refinement using search results
pcl::NormalRefinement<NormalT> nr (k_indices, k_sqr_distances);
nr.setInputCloud (normals.makeShared ());
nr.filter (normals_refined);
NormalEstimation estimates local surface properties (surface normals and curvatures)at each 3D point.
Definition: normal_3d.h:244
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,...
Definition: normal_3d.h:280
Normal vector refinement class
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition: point_cloud.h:173
void push_back(const PointT &pt)
Insert a new point in the cloud, at the end of the container.
Definition: point_cloud.h:663
std::size_t size() const
Definition: point_cloud.h:443
Eigen::Vector4f sensor_origin_
Sensor acquisition pose (origin/translation).
Definition: point_cloud.h:406
Ptr makeShared() const
Copy the cloud to the heap and return a smart pointer Note that deep copy is performed,...
Definition: point_cloud.h:898
int nearestKSearch(const PointT &point, int k, Indices &k_indices, std::vector< float > &k_sqr_distances) const override
Search for the k-nearest neighbors for the given query point.
Definition: kdtree.hpp:88
bool setInputCloud(const PointCloudConstPtr &cloud, const IndicesConstPtr &indices=IndicesConstPtr()) override
Provide a pointer to the input dataset.
Definition: kdtree.hpp:76
void flipNormalTowardsViewpoint(const PointT &point, float vp_x, float vp_y, float vp_z, Eigen::Matrix< Scalar, 4, 1 > &normal)
Flip (in place) the estimated normal of a point towards a given viewpoint.
Definition: normal_3d.h:122
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition: types.h:133
A point structure representing normal coordinates and the surface curvature estimate.
Author
Anders Glent Buch

Definition at line 194 of file normal_refinement.h.

Constructor & Destructor Documentation

◆ NormalRefinement() [1/2]

template<typename NormalT >
pcl::NormalRefinement< NormalT >::NormalRefinement ( )
inline

◆ NormalRefinement() [2/2]

template<typename NormalT >
pcl::NormalRefinement< NormalT >::NormalRefinement ( const std::vector< Indices > &  k_indices,
const std::vector< std::vector< float > > &  k_sqr_distances 
)
inline

Constructor for setting correspondences, sets default convergence parameters.

Parameters
k_indicesindices of neighboring points
k_sqr_distancessquared distances to the neighboring points

Definition at line 219 of file normal_refinement.h.

References pcl::Filter< NormalT >::filter_name_, pcl::NormalRefinement< NormalT >::setConvergenceThreshold(), pcl::NormalRefinement< NormalT >::setCorrespondences(), and pcl::NormalRefinement< NormalT >::setMaxIterations().

Member Function Documentation

◆ applyFilter()

template<typename NormalT >
void pcl::NormalRefinement< NormalT >::applyFilter ( PointCloud output)
overrideprotectedvirtual

Filter a Point Cloud.

Parameters
outputthe resultant point cloud message

Implements pcl::Filter< NormalT >.

Definition at line 48 of file normal_refinement.hpp.

References pcl::refineNormal().

◆ getConvergenceThreshold()

template<typename NormalT >
float pcl::NormalRefinement< NormalT >::getConvergenceThreshold ( )
inline

Get convergence threshold.

Returns
convergence threshold

Definition at line 281 of file normal_refinement.h.

◆ getCorrespondences()

template<typename NormalT >
void pcl::NormalRefinement< NormalT >::getCorrespondences ( std::vector< Indices > &  k_indices,
std::vector< std::vector< float > > &  k_sqr_distances 
)
inline

Get correspondences (copy)

Parameters
k_indicesindices of neighboring points
k_sqr_distancessquared distances to the neighboring points

Definition at line 244 of file normal_refinement.h.

◆ getMaxIterations()

template<typename NormalT >
unsigned int pcl::NormalRefinement< NormalT >::getMaxIterations ( )
inline

Get maximum iterations.

Returns
maximum iterations

Definition at line 263 of file normal_refinement.h.

◆ setConvergenceThreshold()

template<typename NormalT >
void pcl::NormalRefinement< NormalT >::setConvergenceThreshold ( float  convergence_threshold)
inline

Set convergence threshold.

Parameters
convergence_thresholdconvergence threshold

Definition at line 272 of file normal_refinement.h.

Referenced by pcl::NormalRefinement< NormalT >::NormalRefinement().

◆ setCorrespondences()

template<typename NormalT >
void pcl::NormalRefinement< NormalT >::setCorrespondences ( const std::vector< Indices > &  k_indices,
const std::vector< std::vector< float > > &  k_sqr_distances 
)
inline

Set correspondences calculated from nearest neighbor search.

Parameters
k_indicesindices of neighboring points
k_sqr_distancessquared distances to the neighboring points

Definition at line 233 of file normal_refinement.h.

Referenced by pcl::NormalRefinement< NormalT >::NormalRefinement().

◆ setMaxIterations()

template<typename NormalT >
void pcl::NormalRefinement< NormalT >::setMaxIterations ( unsigned int  max_iterations)
inline

Set maximum iterations.

Parameters
max_iterationsmaximum iterations

Definition at line 254 of file normal_refinement.h.

Referenced by pcl::NormalRefinement< NormalT >::NormalRefinement().


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