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. More...
#include <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 Types | |
typedef pcl::search::Search < PointInT > | KdTree |
typedef pcl::search::Search < PointInT >::Ptr | KdTreePtr |
typedef pcl::PointCloud < pcl::Normal > | NormalCloud |
typedef pcl::PointCloud < pcl::Normal >::Ptr | NormalCloudPtr |
typedef pcl::PointCloud< PointInT > | PointCloudIn |
typedef PointCloudIn::ConstPtr | PointCloudInConstPtr |
typedef PointCloudIn::Ptr | PointCloudInPtr |
typedef pcl::PointCloud < PointOutT > | PointCloudOut |
typedef PointCloudOut::ConstPtr | PointCloudOutConstPtr |
typedef PointCloudOut::Ptr | PointCloudOutPtr |
typedef boost::function< int(int, double, std::vector< int > &, std::vector< float > &)> | SearchMethod |
enum | UpsamplingMethod { NONE, SAMPLE_LOCAL_PLANE, RANDOM_UNIFORM_DENSITY, VOXEL_GRID_DILATION } |
Public Member Functions | |
int | getDilationIterations () |
Get the number of dilation steps of the voxel grid. | |
float | getDilationVoxelSize () |
Get the voxel size for the voxel grid. | |
int | getPointDensity () |
Get the parameter that specifies the desired number of points within the search radius. | |
bool | getPolynomialFit () |
Get the polynomial_fit value (true if the surface and normal are approximated using a polynomial). | |
int | getPolynomialOrder () |
Get the order of the polynomial to be fit. | |
KdTreePtr | getSearchMethod () |
Get a pointer to the search method used. | |
double | getSearchRadius () |
Get the sphere radius used for determining the k-nearest neighbors. | |
double | getSqrGaussParam () const |
Get the parameter for distance based weighting of neighbors. | |
double | getUpsamplingRadius () |
Get the radius of the circle in the local point plane that will be sampled. | |
double | getUpsamplingStepSize () |
Get the step size for the local plane sampling. | |
MovingLeastSquares () | |
Empty constructor. | |
void | process (PointCloudOut &output) |
Base method for surface reconstruction for all points given in <setInputCloud (), setIndices ()> | |
void | setComputeNormals (bool compute_normals) |
Set whether the algorithm should also store the normals computed. | |
void | setDilationIterations (int iterations) |
Set the number of dilation steps of the voxel grid. | |
void | setDilationVoxelSize (float voxel_size) |
Set the voxel size for the voxel grid. | |
void | setPointDensity (int desired_num_points_in_radius) |
Set the parameter that specifies the desired number of points within the search radius. | |
void | setPolynomialFit (bool polynomial_fit) |
Sets whether the surface and normal are approximated using a polynomial, or only via tangent estimation. | |
void | setPolynomialOrder (int order) |
Set the order of the polynomial to be fit. | |
void | setSearchMethod (const KdTreePtr &tree) |
Provide a pointer to the search object. | |
void | setSearchRadius (double radius) |
Set the sphere radius that is to be used for determining the k-nearest neighbors used for fitting. | |
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). | |
void | setUpsamplingMethod (UpsamplingMethod method) |
Set the upsampling method to be used. | |
void | setUpsamplingRadius (double radius) |
Set the radius of the circle in the local point plane that will be sampled. | |
void | setUpsamplingStepSize (double step_size) |
Set the step size for the local plane sampling. | |
Protected Member Functions | |
void | computeMLSPointNormal (int index, const PointCloudIn &input, const std::vector< int > &nn_indices, std::vector< float > &nn_sqr_dists, PointCloudOut &projected_points, NormalCloud &projected_points_normals) |
Smooth a given point and its neighborghood using Moving Least Squares. | |
void | projectPointToMLSSurface (float &u_disp, float &v_disp, Eigen::Vector3d &u, Eigen::Vector3d &v, Eigen::Vector3d &plane_normal, float &curvature, Eigen::Vector3f &query_point, Eigen::VectorXd &c_vec, int num_neighbors, PointOutT &result_point, pcl::Normal &result_normal) |
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. | |
int | searchForNeighbors (int index, std::vector< int > &indices, std::vector< float > &sqr_distances) |
Search for the closest nearest neighbors of a given point using a radius search. | |
Protected Attributes | |
bool | compute_normals_ |
Parameter that specifies whether the normals should be computed for the input cloud or not. | |
int | desired_num_points_in_radius_ |
Parameter that specifies the desired number of points within the search radius. | |
int | dilation_iteration_num_ |
Number of dilation steps for the VOXEL_GRID_DILATION upsampling method. | |
std::vector< MLSResult > | mls_results_ |
Stores the MLS result for each point in the input cloud. | |
NormalCloudPtr | normals_ |
The point cloud that will hold the estimated normals, if set. | |
int | nr_coeff_ |
Number of coefficients, to be computed from the requested order. | |
int | order_ |
The order of the polynomial to be fit. | |
bool | polynomial_fit_ |
boost::variate_generator < boost::mt19937, boost::uniform_real< float > > * | rng_uniform_distribution_ |
Random number generator using an uniform distribution of floats. | |
SearchMethod | search_method_ |
The search method template for indices. | |
double | search_radius_ |
The nearest neighbors search radius for each point. | |
double | sqr_gauss_param_ |
Parameter for distance based weighting of neighbors (search_radius_ * search_radius_ works fine) | |
KdTreePtr | tree_ |
A pointer to the spatial search object. | |
UpsamplingMethod | upsample_method_ |
Parameter that specifies the upsampling method to be used. | |
double | upsampling_radius_ |
Radius of the circle in the local point plane that will be sampled. | |
double | upsampling_step_ |
Step size for the local plane sampling. | |
float | voxel_size_ |
Voxel size for the VOXEL_GRID_DILATION upsampling method. | |
Private Member Functions | |
std::string | getClassName () const |
Abstract class get name method. | |
virtual void | performProcessing (PointCloudOut &output) |
Abstract surface reconstruction method. |
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 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::function<int (int, double, std::vector<int> &, std::vector<float> &)> pcl::MovingLeastSquares< PointInT, PointOutT >::SearchMethod |
enum pcl::MovingLeastSquares::UpsamplingMethod |
pcl::MovingLeastSquares< PointInT, PointOutT >::MovingLeastSquares | ( | ) | [inline] |
void pcl::MovingLeastSquares< PointInT, PointOutT >::computeMLSPointNormal | ( | int | index, |
const PointCloudIn & | input, | ||
const std::vector< int > & | nn_indices, | ||
std::vector< float > & | nn_sqr_dists, | ||
PointCloudOut & | projected_points, | ||
NormalCloud & | projected_points_normals | ||
) | [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] | input | the input point cloud that nn_indices refer to |
[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 |
std::string pcl::MovingLeastSquares< PointInT, PointOutT >::getClassName | ( | ) | const [inline, private] |
Abstract class get name method.
Reimplemented in pcl::MovingLeastSquaresOMP< PointInT, PointOutT >, and pcl::MovingLeastSquaresOMP< PointType, PointType >.
int pcl::MovingLeastSquares< PointInT, PointOutT >::getDilationIterations | ( | ) | [inline] |
float pcl::MovingLeastSquares< PointInT, PointOutT >::getDilationVoxelSize | ( | ) | [inline] |
int pcl::MovingLeastSquares< PointInT, PointOutT >::getPointDensity | ( | ) | [inline] |
bool pcl::MovingLeastSquares< PointInT, PointOutT >::getPolynomialFit | ( | ) | [inline] |
int pcl::MovingLeastSquares< PointInT, PointOutT >::getPolynomialOrder | ( | ) | [inline] |
KdTreePtr pcl::MovingLeastSquares< PointInT, PointOutT >::getSearchMethod | ( | ) | [inline] |
double pcl::MovingLeastSquares< PointInT, PointOutT >::getSearchRadius | ( | ) | [inline] |
double pcl::MovingLeastSquares< PointInT, PointOutT >::getSqrGaussParam | ( | ) | const [inline] |
double pcl::MovingLeastSquares< PointInT, PointOutT >::getUpsamplingRadius | ( | ) | [inline] |
double pcl::MovingLeastSquares< PointInT, PointOutT >::getUpsamplingStepSize | ( | ) | [inline] |
void pcl::MovingLeastSquares< PointInT, PointOutT >::performProcessing | ( | PointCloudOut & | output | ) | [private, virtual] |
Abstract surface reconstruction method.
[out] | output | the result of the reconstruction |
Reimplemented in pcl::MovingLeastSquaresOMP< PointInT, PointOutT >, and pcl::MovingLeastSquaresOMP< PointType, PointType >.
void pcl::MovingLeastSquares< PointInT, PointOutT >::process | ( | PointCloudOut & | output | ) |
void pcl::MovingLeastSquares< PointInT, PointOutT >::projectPointToMLSSurface | ( | float & | u_disp, |
float & | v_disp, | ||
Eigen::Vector3d & | u, | ||
Eigen::Vector3d & | v, | ||
Eigen::Vector3d & | plane_normal, | ||
float & | curvature, | ||
Eigen::Vector3f & | query_point, | ||
Eigen::VectorXd & | c_vec, | ||
int | num_neighbors, | ||
PointOutT & | result_point, | ||
pcl::Normal & | result_normal | ||
) | [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 |
int pcl::MovingLeastSquares< PointInT, PointOutT >::searchForNeighbors | ( | int | index, |
std::vector< int > & | indices, | ||
std::vector< float > & | sqr_distances | ||
) | [inline, protected] |
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 |
void pcl::MovingLeastSquares< PointInT, PointOutT >::setComputeNormals | ( | bool | compute_normals | ) | [inline] |
void pcl::MovingLeastSquares< PointInT, PointOutT >::setDilationIterations | ( | int | iterations | ) | [inline] |
void pcl::MovingLeastSquares< PointInT, PointOutT >::setDilationVoxelSize | ( | float | voxel_size | ) | [inline] |
void pcl::MovingLeastSquares< PointInT, PointOutT >::setPointDensity | ( | int | desired_num_points_in_radius | ) | [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 |
void pcl::MovingLeastSquares< PointInT, PointOutT >::setPolynomialFit | ( | bool | polynomial_fit | ) | [inline] |
void pcl::MovingLeastSquares< PointInT, PointOutT >::setPolynomialOrder | ( | int | order | ) | [inline] |
void pcl::MovingLeastSquares< PointInT, PointOutT >::setSearchMethod | ( | const KdTreePtr & | tree | ) | [inline] |
void pcl::MovingLeastSquares< PointInT, PointOutT >::setSearchRadius | ( | double | radius | ) | [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 |
void pcl::MovingLeastSquares< PointInT, PointOutT >::setSqrGaussParam | ( | double | sqr_gauss_param | ) | [inline] |
void pcl::MovingLeastSquares< PointInT, PointOutT >::setUpsamplingMethod | ( | UpsamplingMethod | method | ) | [inline] |
Set the upsampling method to be used.
void pcl::MovingLeastSquares< PointInT, PointOutT >::setUpsamplingRadius | ( | double | radius | ) | [inline] |
void pcl::MovingLeastSquares< PointInT, PointOutT >::setUpsamplingStepSize | ( | double | step_size | ) | [inline] |
bool pcl::MovingLeastSquares< PointInT, PointOutT >::compute_normals_ [protected] |
int pcl::MovingLeastSquares< PointInT, PointOutT >::desired_num_points_in_radius_ [protected] |
int pcl::MovingLeastSquares< PointInT, PointOutT >::dilation_iteration_num_ [protected] |
std::vector<MLSResult> pcl::MovingLeastSquares< PointInT, PointOutT >::mls_results_ [protected] |
NormalCloudPtr pcl::MovingLeastSquares< PointInT, PointOutT >::normals_ [protected] |
int pcl::MovingLeastSquares< PointInT, PointOutT >::nr_coeff_ [protected] |
int pcl::MovingLeastSquares< PointInT, PointOutT >::order_ [protected] |
bool pcl::MovingLeastSquares< PointInT, PointOutT >::polynomial_fit_ [protected] |
boost::variate_generator<boost::mt19937, boost::uniform_real<float> >* pcl::MovingLeastSquares< PointInT, PointOutT >::rng_uniform_distribution_ [protected] |
SearchMethod pcl::MovingLeastSquares< PointInT, PointOutT >::search_method_ [protected] |
double pcl::MovingLeastSquares< PointInT, PointOutT >::search_radius_ [protected] |
double pcl::MovingLeastSquares< PointInT, PointOutT >::sqr_gauss_param_ [protected] |
KdTreePtr pcl::MovingLeastSquares< PointInT, PointOutT >::tree_ [protected] |
UpsamplingMethod pcl::MovingLeastSquares< PointInT, PointOutT >::upsample_method_ [protected] |
double pcl::MovingLeastSquares< PointInT, PointOutT >::upsampling_radius_ [protected] |
double pcl::MovingLeastSquares< PointInT, PointOutT >::upsampling_step_ [protected] |
float pcl::MovingLeastSquares< PointInT, PointOutT >::voxel_size_ [protected] |