Point Cloud Library (PCL)
1.7.0
|
MovingLeastSquares represent an implementation of the MLS (Moving Least Squares) algorithm for data smoothing and improved normal estimation. More...
#include <pcl/surface/mls.h>
Classes | |
struct | MLSResult |
Data structure used to store the results of the MLS fitting. More... | |
class | MLSVoxelGrid |
A minimalistic implementation of a voxel grid, necessary for the point cloud upsampling. More... | |
Public Member Functions | |
MovingLeastSquares () | |
Empty constructor. More... | |
virtual | ~MovingLeastSquares () |
Empty destructor. More... | |
void | setComputeNormals (bool compute_normals) |
Set whether the algorithm should also store the normals computed. More... | |
void | setSearchMethod (const KdTreePtr &tree) |
Provide a pointer to the search object. More... | |
KdTreePtr | getSearchMethod () |
Get a pointer to the search method used. More... | |
void | setPolynomialOrder (int order) |
Set the order of the polynomial to be fit. More... | |
int | getPolynomialOrder () |
Get the order of the polynomial to be fit. More... | |
void | setPolynomialFit (bool polynomial_fit) |
Sets whether the surface and normal are approximated using a polynomial, or only via tangent estimation. More... | |
bool | getPolynomialFit () |
Get the polynomial_fit value (true if the surface and normal are approximated using a polynomial). More... | |
void | setSearchRadius (double radius) |
Set the sphere radius that is to be used for determining the k-nearest neighbors used for fitting. More... | |
double | getSearchRadius () |
Get the sphere radius used for determining the k-nearest neighbors. More... | |
void | setSqrGaussParam (double sqr_gauss_param) |
Set the parameter used for distance based weighting of neighbors (the square of the search radius works best in general). More... | |
double | getSqrGaussParam () const |
Get the parameter for distance based weighting of neighbors. More... | |
void | setUpsamplingMethod (UpsamplingMethod method) |
Set the upsampling method to be used. More... | |
void | setDistinctCloud (PointCloudInConstPtr distinct_cloud) |
Set the distinct cloud used for the DISTINCT_CLOUD upsampling method. More... | |
PointCloudInConstPtr | getDistinctCloud () |
Get the distinct cloud used for the DISTINCT_CLOUD upsampling method. More... | |
void | setUpsamplingRadius (double radius) |
Set the radius of the circle in the local point plane that will be sampled. More... | |
double | getUpsamplingRadius () |
Get the radius of the circle in the local point plane that will be sampled. More... | |
void | setUpsamplingStepSize (double step_size) |
Set the step size for the local plane sampling. More... | |
double | getUpsamplingStepSize () |
Get the step size for the local plane sampling. More... | |
void | setPointDensity (int desired_num_points_in_radius) |
Set the parameter that specifies the desired number of points within the search radius. More... | |
int | getPointDensity () |
Get the parameter that specifies the desired number of points within the search radius. More... | |
void | setDilationVoxelSize (float voxel_size) |
Set the voxel size for the voxel grid. More... | |
float | getDilationVoxelSize () |
Get the voxel size for the voxel grid. More... | |
void | setDilationIterations (int iterations) |
Set the number of dilation steps of the voxel grid. More... | |
int | getDilationIterations () |
Get the number of dilation steps of the voxel grid. More... | |
void | process (PointCloudOut &output) |
Base method for surface reconstruction for all points given in <setInputCloud (), setIndices ()> More... | |
PointIndicesPtr | getCorrespondingIndices () |
Get the set of indices with each point in output having the corresponding point in input. More... | |
![]() | |
CloudSurfaceProcessing () | |
Constructor. More... | |
virtual | ~CloudSurfaceProcessing () |
Empty destructor. More... | |
![]() | |
PCLBase () | |
Empty constructor. More... | |
PCLBase (const PCLBase &base) | |
Copy constructor. More... | |
virtual | ~PCLBase () |
Destructor. More... | |
virtual void | setInputCloud (const PointCloudConstPtr &cloud) |
Provide a pointer to the input dataset. More... | |
PointCloudConstPtr const | getInputCloud () |
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 (size_t row_start, size_t col_start, size_t nb_rows, size_t nb_cols) |
Set the indices for the points laying within an interest region of the point cloud. More... | |
IndicesPtr const | getIndices () |
Get a pointer to the vector of indices used. More... | |
const PointInT & | operator[] (size_t pos) |
Override PointCloud operator[] to shorten code. More... | |
Protected Member Functions | |
int | searchForNeighbors (int index, std::vector< int > &indices, std::vector< float > &sqr_distances) const |
Search for the closest nearest neighbors of a given point using a radius search. More... | |
void | computeMLSPointNormal (int index, const std::vector< int > &nn_indices, std::vector< float > &nn_sqr_dists, PointCloudOut &projected_points, NormalCloud &projected_points_normals, PointIndices &corresponding_input_indices, MLSResult &mls_result) const |
Smooth a given point and its neighborghood using Moving Least Squares. More... | |
void | projectPointToMLSSurface (float &u_disp, float &v_disp, Eigen::Vector3d &u_axis, Eigen::Vector3d &v_axis, Eigen::Vector3d &n_axis, Eigen::Vector3d &mean, float &curvature, Eigen::VectorXd &c_vec, int num_neighbors, PointOutT &result_point, pcl::Normal &result_normal) const |
Fits a point (sample point) given in the local plane coordinates of an input point (query point) to the MLS surface of the input point. More... | |
void | copyMissingFields (const PointInT &point_in, PointOutT &point_out) const |
virtual void | performProcessing (PointCloudOut &output) |
Abstract surface reconstruction method. More... | |
void | performUpsampling (PointCloudOut &output) |
Perform upsampling for the distinct-cloud and voxel-grid methods. More... | |
Protected Attributes | |
NormalCloudPtr | normals_ |
The point cloud that will hold the estimated normals, if set. More... | |
PointCloudInConstPtr | distinct_cloud_ |
The distinct point cloud that will be projected to the MLS surface. More... | |
SearchMethod | search_method_ |
The search method template for indices. More... | |
KdTreePtr | tree_ |
A pointer to the spatial search object. More... | |
int | order_ |
The order of the polynomial to be fit. More... | |
bool | polynomial_fit_ |
True if the surface and normal be approximated using a polynomial, false if tangent estimation is sufficient. More... | |
double | search_radius_ |
The nearest neighbors search radius for each point. More... | |
double | sqr_gauss_param_ |
Parameter for distance based weighting of neighbors (search_radius_ * search_radius_ works fine) More... | |
bool | compute_normals_ |
Parameter that specifies whether the normals should be computed for the input cloud or not. More... | |
UpsamplingMethod | upsample_method_ |
Parameter that specifies the upsampling method to be used. More... | |
double | upsampling_radius_ |
Radius of the circle in the local point plane that will be sampled. More... | |
double | upsampling_step_ |
Step size for the local plane sampling. More... | |
int | desired_num_points_in_radius_ |
Parameter that specifies the desired number of points within the search radius. More... | |
std::vector< MLSResult > | mls_results_ |
Stores the MLS result for each point in the input cloud. More... | |
float | voxel_size_ |
Voxel size for the VOXEL_GRID_DILATION upsampling method. More... | |
int | dilation_iteration_num_ |
Number of dilation steps for the VOXEL_GRID_DILATION upsampling method. More... | |
int | nr_coeff_ |
Number of coefficients, to be computed from the requested order. More... | |
PointIndicesPtr | corresponding_input_indices_ |
Collects for each point in output the corrseponding point in the input. More... | |
MovingLeastSquares represent an implementation of the MLS (Moving Least Squares) algorithm for data smoothing and improved normal estimation.
It also contains methods for upsampling the resulting cloud based on the parametric fit. Reference paper: "Computing and Rendering Point Set Surfaces" by Marc Alexa, Johannes Behr, Daniel Cohen-Or, Shachar Fleishman, David Levin and Claudio T. Silva www.sci.utah.edu/~shachar/Publications/crpss.pdf
typedef boost::shared_ptr<const MovingLeastSquares<PointInT, PointOutT> > pcl::MovingLeastSquares< PointInT, PointOutT >::ConstPtr |
typedef pcl::search::Search<PointInT> pcl::MovingLeastSquares< PointInT, PointOutT >::KdTree |
typedef pcl::search::Search<PointInT>::Ptr pcl::MovingLeastSquares< PointInT, PointOutT >::KdTreePtr |
typedef pcl::PointCloud<pcl::Normal> pcl::MovingLeastSquares< PointInT, PointOutT >::NormalCloud |
typedef pcl::PointCloud<pcl::Normal>::Ptr pcl::MovingLeastSquares< PointInT, PointOutT >::NormalCloudPtr |
typedef pcl::PointCloud<PointInT> pcl::MovingLeastSquares< PointInT, PointOutT >::PointCloudIn |
typedef PointCloudIn::ConstPtr pcl::MovingLeastSquares< PointInT, PointOutT >::PointCloudInConstPtr |
typedef PointCloudIn::Ptr pcl::MovingLeastSquares< PointInT, PointOutT >::PointCloudInPtr |
typedef pcl::PointCloud<PointOutT> pcl::MovingLeastSquares< PointInT, PointOutT >::PointCloudOut |
typedef PointCloudOut::ConstPtr pcl::MovingLeastSquares< PointInT, PointOutT >::PointCloudOutConstPtr |
typedef PointCloudOut::Ptr pcl::MovingLeastSquares< PointInT, PointOutT >::PointCloudOutPtr |
typedef boost::shared_ptr<MovingLeastSquares<PointInT, PointOutT> > pcl::MovingLeastSquares< PointInT, PointOutT >::Ptr |
typedef boost::function<int (int, double, std::vector<int> &, std::vector<float> &)> pcl::MovingLeastSquares< PointInT, PointOutT >::SearchMethod |
enum pcl::MovingLeastSquares::UpsamplingMethod |
|
inline |
|
inlinevirtual |
|
protected |
Smooth a given point and its neighborghood using Moving Least Squares.
[in] | index | the inex of the query point in the input cloud |
[in] | nn_indices | the set of nearest neighbors indices for pt |
[in] | nn_sqr_dists | the set of nearest neighbors squared distances for pt |
[out] | projected_points | the set of points projected points around the query point (in the case of upsampling method NONE, only the query point projected to its own fitted surface will be returned, in the case of the other upsampling methods, multiple points will be returned) |
[out] | projected_points_normals | the normals corresponding to the projected points |
[out] | corresponding_input_indices | the set of indices with each point in output having the corresponding point in input |
[out] | mls_result | stores the MLS result for each point in the input cloud (used only in the case of VOXEL_GRID_DILATION or DISTINCT_CLOUD upsampling) |
Definition at line 159 of file mls.hpp.
References pcl::compute3DCentroid(), pcl::computeCovarianceMatrix(), pcl::_Normal::curvature, pcl::eigen33(), pcl::EIGEN_ALIGN16, pcl::PointIndices::indices, and pcl::PointCloud< T >::push_back().
|
protected |
|
inline |
Get the set of indices with each point in output having the corresponding point in input.
Definition at line 295 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::corresponding_input_indices_.
|
inline |
Get the number of dilation steps of the voxel grid.
Definition at line 283 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::dilation_iteration_num_.
|
inline |
Get the voxel size for the voxel grid.
Definition at line 270 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::voxel_size_.
|
inline |
Get the distinct cloud used for the DISTINCT_CLOUD upsampling method.
Definition at line 213 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::distinct_cloud_.
|
inline |
Get the parameter that specifies the desired number of points within the search radius.
Definition at line 256 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::desired_num_points_in_radius_.
|
inline |
Get the polynomial_fit value (true if the surface and normal are approximated using a polynomial).
Definition at line 162 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::polynomial_fit_.
|
inline |
Get the order of the polynomial to be fit.
Definition at line 152 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::order_.
|
inline |
Get a pointer to the search method used.
Definition at line 142 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::tree_.
|
inline |
Get the sphere radius used for determining the k-nearest neighbors.
Definition at line 173 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::search_radius_.
|
inline |
Get the parameter for distance based weighting of neighbors.
Definition at line 184 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::sqr_gauss_param_.
|
inline |
Get the radius of the circle in the local point plane that will be sampled.
Definition at line 227 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::upsampling_radius_.
|
inline |
Get the step size for the local plane sampling.
Definition at line 241 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::upsampling_step_.
|
protectedvirtual |
Abstract surface reconstruction method.
[out] | output | the result of the reconstruction |
Implements pcl::CloudSurfaceProcessing< PointInT, PointOutT >.
Definition at line 460 of file mls.hpp.
References pcl::PointCloud< T >::begin(), pcl::PointCloud< T >::end(), pcl::PointCloud< T >::insert(), and pcl::PointCloud< T >::size().
|
protected |
Perform upsampling for the distinct-cloud and voxel-grid methods.
[out] | output | the result of the reconstruction |
Definition at line 573 of file mls.hpp.
References pcl::MovingLeastSquares< PointInT, PointOutT >::MLSVoxelGrid::dilate(), pcl::MovingLeastSquares< PointInT, PointOutT >::MLSVoxelGrid::getPosition(), pcl::PointCloud< T >::push_back(), and pcl::MovingLeastSquares< PointInT, PointOutT >::MLSVoxelGrid::voxel_grid_.
|
virtual |
Base method for surface reconstruction for all points given in <setInputCloud (), setIndices ()>
[out] | output | the resultant reconstructed surface model |
Reimplemented from pcl::CloudSurfaceProcessing< PointInT, PointOutT >.
Definition at line 56 of file mls.hpp.
References pcl::PointCloud< T >::header, pcl::PointCloud< T >::height, pcl::PointCloud< T >::points, pcl::PointCloud< T >::size(), and pcl::PointCloud< T >::width.
|
protected |
Fits a point (sample point) given in the local plane coordinates of an input point (query point) to the MLS surface of the input point.
[in] | u_disp | the u coordinate of the sample point in the local plane of the query point |
[in] | v_disp | the v coordinate of the sample point in the local plane of the query point |
[in] | u | the axis corresponding to the u-coordinates of the local plane of the query point |
[in] | v | the axis corresponding to the v-coordinates of the local plane of the query point |
[in] | plane_normal | the normal to the local plane of the query point |
[in] | curvature | the curvature of the surface at the query point |
[in] | query_point | the absolute 3D position of the query point |
[in] | c_vec | the coefficients of the polynomial fit on the MLS surface of the query point |
[in] | num_neighbors | the number of neighbors of the query point in the input cloud |
[out] | result_point | the absolute 3D position of the resulting projected point |
[out] | result_normal | the normal of the resulting projected point |
Definition at line 403 of file mls.hpp.
References pcl::_Normal::curvature.
|
inlineprotected |
Search for the closest nearest neighbors of a given point using a radius search.
[in] | index | the index of the query point |
[out] | indices | the resultant vector of indices representing the k-nearest neighbors |
[out] | sqr_distances | the resultant squared distances from the query point to the k-nearest neighbors |
Definition at line 446 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::search_method_, and pcl::MovingLeastSquares< PointInT, PointOutT >::search_radius_.
|
inline |
Set whether the algorithm should also store the normals computed.
Definition at line 126 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::compute_normals_.
|
inline |
Set the number of dilation steps of the voxel grid.
[in] | iterations | the number of dilation iterations |
Definition at line 277 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::dilation_iteration_num_.
|
inline |
Set the voxel size for the voxel grid.
[in] | voxel_size | the edge length of a cubic voxel in the voxel grid |
Definition at line 263 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::voxel_size_.
|
inline |
Set the distinct cloud used for the DISTINCT_CLOUD upsampling method.
Definition at line 209 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::distinct_cloud_.
|
inline |
Set the parameter that specifies the desired number of points within the search radius.
[in] | desired_num_points_in_radius | the desired number of points in the output cloud in a sphere of radius search_radius_ around each point |
Definition at line 249 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::desired_num_points_in_radius_.
|
inline |
Sets whether the surface and normal are approximated using a polynomial, or only via tangent estimation.
[in] | polynomial_fit | set to true for polynomial fit |
Definition at line 158 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::polynomial_fit_.
|
inline |
Set the order of the polynomial to be fit.
[in] | order | the order of the polynomial |
Definition at line 148 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::order_.
|
inline |
Provide a pointer to the search object.
[in] | tree | a pointer to the spatial search object. |
Definition at line 132 of file mls.h.
References pcl::search::Search< PointInT >::radiusSearch(), pcl::MovingLeastSquares< PointInT, PointOutT >::search_method_, and pcl::MovingLeastSquares< PointInT, PointOutT >::tree_.
|
inline |
Set the sphere radius that is to be used for determining the k-nearest neighbors used for fitting.
[in] | radius | the sphere radius that is to contain all k-nearest neighbors |
Definition at line 169 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::search_radius_, and pcl::MovingLeastSquares< PointInT, PointOutT >::sqr_gauss_param_.
|
inline |
Set the parameter used for distance based weighting of neighbors (the square of the search radius works best in general).
[in] | sqr_gauss_param | the squared Gaussian parameter |
Definition at line 180 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::sqr_gauss_param_.
|
inline |
Set the upsampling method to be used.
Definition at line 205 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::upsample_method_.
|
inline |
Set the radius of the circle in the local point plane that will be sampled.
[in] | radius | the radius of the circle |
Definition at line 221 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::upsampling_radius_.
|
inline |
Set the step size for the local plane sampling.
[in] | step_size | the step size |
Definition at line 234 of file mls.h.
References pcl::MovingLeastSquares< PointInT, PointOutT >::upsampling_step_.
|
protected |
Parameter that specifies whether the normals should be computed for the input cloud or not.
Definition at line 323 of file mls.h.
Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::setComputeNormals().
|
protected |
Collects for each point in output the corrseponding point in the input.
Definition at line 438 of file mls.h.
Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::getCorrespondingIndices().
|
protected |
Parameter that specifies the desired number of points within the search radius.
Definition at line 341 of file mls.h.
Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::getPointDensity(), and pcl::MovingLeastSquares< PointInT, PointOutT >::setPointDensity().
|
protected |
Number of dilation steps for the VOXEL_GRID_DILATION upsampling method.
Definition at line 432 of file mls.h.
Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::getDilationIterations(), and pcl::MovingLeastSquares< PointInT, PointOutT >::setDilationIterations().
|
protected |
The distinct point cloud that will be projected to the MLS surface.
Definition at line 302 of file mls.h.
Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::getDistinctCloud(), and pcl::MovingLeastSquares< PointInT, PointOutT >::setDistinctCloud().
|
protected |
|
protected |
|
protected |
|
protected |
The order of the polynomial to be fit.
Definition at line 311 of file mls.h.
Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::getPolynomialOrder(), and pcl::MovingLeastSquares< PointInT, PointOutT >::setPolynomialOrder().
|
protected |
True if the surface and normal be approximated using a polynomial, false if tangent estimation is sufficient.
Definition at line 314 of file mls.h.
Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::getPolynomialFit(), and pcl::MovingLeastSquares< PointInT, PointOutT >::setPolynomialFit().
|
protected |
The search method template for indices.
Definition at line 305 of file mls.h.
Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::searchForNeighbors(), and pcl::MovingLeastSquares< PointInT, PointOutT >::setSearchMethod().
|
protected |
The nearest neighbors search radius for each point.
Definition at line 317 of file mls.h.
Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::getSearchRadius(), pcl::MovingLeastSquares< PointInT, PointOutT >::searchForNeighbors(), and pcl::MovingLeastSquares< PointInT, PointOutT >::setSearchRadius().
|
protected |
Parameter for distance based weighting of neighbors (search_radius_ * search_radius_ works fine)
Definition at line 320 of file mls.h.
Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::getSqrGaussParam(), pcl::MovingLeastSquares< PointInT, PointOutT >::setSearchRadius(), and pcl::MovingLeastSquares< PointInT, PointOutT >::setSqrGaussParam().
|
protected |
A pointer to the spatial search object.
Definition at line 308 of file mls.h.
Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::getSearchMethod(), and pcl::MovingLeastSquares< PointInT, PointOutT >::setSearchMethod().
|
protected |
Parameter that specifies the upsampling method to be used.
Definition at line 326 of file mls.h.
Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::setUpsamplingMethod().
|
protected |
Radius of the circle in the local point plane that will be sampled.
Definition at line 331 of file mls.h.
Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::getUpsamplingRadius(), and pcl::MovingLeastSquares< PointInT, PointOutT >::setUpsamplingRadius().
|
protected |
Step size for the local plane sampling.
Definition at line 336 of file mls.h.
Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::getUpsamplingStepSize(), and pcl::MovingLeastSquares< PointInT, PointOutT >::setUpsamplingStepSize().
|
protected |
Voxel size for the VOXEL_GRID_DILATION upsampling method.
Definition at line 429 of file mls.h.
Referenced by pcl::MovingLeastSquares< PointInT, PointOutT >::getDilationVoxelSize(), and pcl::MovingLeastSquares< PointInT, PointOutT >::setDilationVoxelSize().