Loading...
Searching...
No Matches
pcl::NormalRefinement< NormalT > Class Template Reference
Module filters

Normal vector refinement class More...

`#include <pcl/filters/normal_refinement.h>`

Inheritance diagram for pcl::NormalRefinement< NormalT >:

## Public Member Functions

| NormalRefinement ()
| Empty constructor, sets default convergence parameters.
| NormalRefinement (const std::vector< Indices > &k_indices, const std::vector< std::vector< float > > &k_sqr_distances)
| Constructor for setting correspondences, sets default convergence parameters.
void | setCorrespondences (const std::vector< Indices > &k_indices, const std::vector< std::vector< float > > &k_sqr_distances)
| Set correspondences calculated from nearest neighbor search.
void | getCorrespondences (std::vector< Indices > &k_indices, std::vector< std::vector< float > > &k_sqr_distances)
| Get correspondences (copy).
void | setMaxIterations (unsigned int max_iterations)
| Set maximum iterations.
unsigned int | getMaxIterations ()
| Get maximum iterations.
void | setConvergenceThreshold (float convergence_threshold)
| Set convergence threshold.
float | getConvergenceThreshold ()
| Get convergence threshold.
Public Member Functions inherited from pcl::Filter< NormalT >
| Filter (bool extract_removed_indices=false)
| Empty constructor.
IndicesConstPtr const | getRemovedIndices () const
| Get the point indices being removed.
void | filter (PointCloud &output)
| Calls the filtering method and returns the filtered dataset in output.
Public Member Functions inherited from pcl::PCLBase< NormalT >
| PCLBase ()
| Empty constructor.
virtual | ~PCLBase ()=default
| Destructor.
virtual void | setInputCloud (const PointCloudConstPtr &cloud)
| Provide a pointer to the input dataset.
PointCloudConstPtr const | getInputCloud () const
| Get a pointer to the input point cloud dataset.
virtual void | setIndices (const IndicesPtr &indices)
| Provide a pointer to the vector of indices that represents the input data.
IndicesPtr | getIndices ()
| Get a pointer to the vector of indices used.
const NormalT & | operator[] (std::size_t pos) const
| Override PointCloud operator[] to shorten code.

## Protected Member Functions

void | applyFilter (PointCloud &output) override
| Filter a Point Cloud.
Protected Member Functions inherited from pcl::Filter< NormalT >
virtual void | applyFilter (PointCloud &output)=0
| Abstract filter method.
const std::string & | getClassName () const
| Get a string representation of the name of this class.
Protected Member Functions inherited from pcl::PCLBase< NormalT >
bool | initCompute ()
| This method should get called before starting the actual computation.
bool | deinitCompute ()
| This method should get called after finishing the actual computation.

## Additional Inherited Members

Public Types inherited from pcl::Filter< NormalT >
using | Ptr
using | ConstPtr
using | PointCloud
using | PointCloudPtr
using | PointCloudConstPtr
Public Types inherited from pcl::PCLBase< NormalT >
using | PointCloud
using | PointCloudPtr
using | PointCloudConstPtr
using | PointIndicesPtr
using | PointIndicesConstPtr
Protected Attributes inherited from pcl::Filter< NormalT >
IndicesPtr | removed_indices_
| Indices of the points that are removed.
std::string | filter_name_
| The filter name.
bool | extract_removed_indices_
| Set to true if we want to return the indices of the removed points.
Protected Attributes inherited from pcl::PCLBase< NormalT >
PointCloudConstPtr | input_
| The input point cloud dataset.
IndicesPtr | indices_
| A pointer to the vector of point indices to use.
bool | use_indices_
| Set to true if point indices are used.
bool | fake_indices_
| If no set of indices are given, we construct a set of fake indices that mimic the input PointCloud.

## 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
pcl::PointCloud<PointT> cloud;
// Fill cloud...
// Estimated and refined normals
pcl::PointCloud<NormalT> 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
pcl::search::KdTree<pcl::PointXYZRGB> search;
search.setInputCloud (cloud.makeShared ());
search.nearestKSearch (cloud, Indices (), k, k_indices, k_sqr_distances);
// Use search results for normal estimation
pcl::NormalEstimation<PointT, NormalT> ne;
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);
pcl::flipNormalTowardsViewpoint (cloud[i], cloud.sensor_origin_[0], cloud.sensor_origin_[1], cloud.sensor_origin_[2],
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);
pcl::NormalEstimation
NormalEstimation estimates local surface properties (surface normals and curvatures)at each 3D point.
Definition normal_3d.h:244
pcl::NormalEstimation::computePointNormal
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
pcl::NormalRefinement
Normal vector refinement class
Definition normal_refinement.h:195
pcl::PointCloud
PointCloud represents the base class in PCL for storing collections of 3D points.
Definition point_cloud.h:174
pcl::PointCloud::push_back
void push_back(const PointT &pt)
Insert a new point in the cloud, at the end of the container.
Definition point_cloud.h:664
pcl::PointCloud::size
std::size_t size() const
Definition point_cloud.h:444
pcl::PointCloud::sensor_origin_
Eigen::Vector4f sensor_origin_
Sensor acquisition pose (origin/translation).
Definition point_cloud.h:407
pcl::PointCloud::makeShared
Ptr makeShared() const
Copy the cloud to the heap and return a smart pointer Note that deep copy is performed,...
Definition point_cloud.h:899
pcl::search::KdTree
search::KdTree is a wrapper class which inherits the pcl::KdTree class for performing search function...
Definition kdtree.h:62
pcl::flipNormalTowardsViewpoint
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
pcl::search
Definition brute_force.h:45
pcl::Indices
IndicesAllocator<> Indices
Type used for indices in PCL.
Definition types.h:133
pcl::_Normal::curvature
float curvature
Definition point_types.hpp:782

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

Empty constructor, sets default convergence parameters.

Definition at line 207 of file normal_refinement.h.

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

## 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_indices | indices of neighboring points
  k_sqr_distances | squared distances to the neighboring points

Definition at line 219 of file normal_refinement.h.

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

## Member Function Documentation

## applyFilter()

template<typename NormalT>

void pcl::NormalRefinement< NormalT >::applyFilter | ( | PointCloud & | output | ) |

override protected

Filter a Point Cloud.

Parameters

  output | the resultant point cloud message

Definition at line 48 of file normal_refinement.hpp.

References pcl::Filter< NormalT >::getClassName(), pcl::PCLBase< NormalT >::input_, and 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_indices | indices of neighboring points
  k_sqr_distances | squared 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_threshold | convergence threshold

Definition at line 272 of file normal_refinement.h.

Referenced by NormalRefinement(), and 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_indices | indices of neighboring points
  k_sqr_distances | squared distances to the neighboring points

Definition at line 233 of file normal_refinement.h.

Referenced by NormalRefinement().

## setMaxIterations()

template<typename NormalT>

void pcl::NormalRefinement< NormalT >::setMaxIterations | ( | unsigned int | max_iterations | ) |

inline

Set maximum iterations.

Parameters

  max_iterations | maximum iterations

Definition at line 254 of file normal_refinement.h.

Referenced by NormalRefinement(), and NormalRefinement().

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

- pcl/filters/normal_refinement.h
- pcl/filters/impl/normal_refinement.hpp