Point Cloud Library (PCL)  1.10.1-dev
Module sample_consensus

# Overview

The pcl_sample_consensus library holds SAmple Consensus (SAC) methods like RANSAC and models like planes and cylinders. These can combined freely in order to detect specific models and their parameters in point clouds.

Some of the models implemented in this library include: lines, planes, cylinders, and spheres. Plane fitting is often applied to the task of detecting common indoor surfaces, such as walls, floors, and table tops. Other models can be used to detect and segment objects with common geometric structures (e.g., fitting a cylinder model to a mug). The following models are supported:

• SACMODEL_PLANE - used to determine plane models. The four coefficients of the plane are its Hessian Normal form: [normal_x normal_y normal_z d]
• SACMODEL_LINE - used to determine line models. The six coefficients of the line are given by a point on the line and the direction of the line as: [point_on_line.x point_on_line.y point_on_line.z line_direction.x line_direction.y line_direction.z]
• SACMODEL_CIRCLE2D - used to determine 2D circles in a plane. The circle's three coefficients are given by its center and radius as: [center.x center.y radius]
• SACMODEL_CIRCLE3D - used to determine 3D circles in a plane. The circle's seven coefficients are given by its center, radius and normal as: [center.x, center.y, center.z, radius, normal.x, normal.y, normal.z]
• SACMODEL_SPHERE - used to determine sphere models. The four coefficients of the sphere are given by its 3D center and radius as: [center.x center.y center.z radius]
• SACMODEL_CYLINDER - used to determine cylinder models. The seven coefficients of the cylinder are given by a point on its axis, the axis direction, and a radius, as: [point_on_axis.x point_on_axis.y point_on_axis.z axis_direction.x axis_direction.y axis_direction.z radius]
• SACMODEL_CONE - used to determine cone models. The seven coefficients of the cone are given by a point of its apex, the axis direction and the opening angle, as: [apex.x, apex.y, apex.z, axis_direction.x, axis_direction.y, axis_direction.z, opening_angle]
• SACMODEL_TORUS - not implemented yet
• SACMODEL_PARALLEL_LINE - a model for determining a line parallel with a given axis, within a maximum specified angular deviation. The line coefficients are similar to SACMODEL_LINE .
• SACMODEL_PERPENDICULAR_PLANE - a model for determining a plane perpendicular to a user-specified axis, within a maximum specified angular deviation. The plane coefficients are similar to SACMODEL_PLANE .
• SACMODEL_PARALLEL_LINES - not implemented yet
• SACMODEL_NORMAL_PLANE - a model for determining plane models using an additional constraint: the surface normals at each inlier point has to be parallel to the surface normal of the output plane, within a maximum specified angular deviation. The plane coefficients are similar to SACMODEL_PLANE .
• SACMODEL_NORMAL_SPHERE - similar to SACMODEL_SPHERE , but with additional surface normal constraints.
• SACMODEL_PARALLEL_PLANE - a model for determining a plane parallel to a user-specified axis, within a maximum specified angular deviation. The plane coefficients are similar to SACMODEL_PLANE .
• SACMODEL_NORMAL_PARALLEL_PLANE defines a model for 3D plane segmentation using additional surface normal constraints. The plane normal must lie parallel to a user-specified axis. SACMODEL_NORMAL_PARALLEL_PLANE therefore is equivalent to SACMODEL_NORMAL_PLANE + SACMODEL_PERPENDICULAR_PLANE. The plane coefficients are similar to SACMODEL_PLANE .
• SACMODEL_STICK - a model for 3D stick segmentation. A stick is a line with a user given minimum/maximum width.

The following list describes the robust sample consensus estimators implemented:

By default, if you're not familiar with most of the above estimators and how they operate, use RANSAC to test your hypotheses.

# Requirements

## Classes

class  pcl::LeastMedianSquares< PointT >
LeastMedianSquares represents an implementation of the LMedS (Least Median of Squares) algorithm. More...

class  pcl::MaximumLikelihoodSampleConsensus< PointT >
MaximumLikelihoodSampleConsensus represents an implementation of the MLESAC (Maximum Likelihood Estimator SAmple Consensus) algorithm, as described in: "MLESAC: A new robust estimator with application to estimating image geometry", P.H.S. More...

class  pcl::MEstimatorSampleConsensus< PointT >
MEstimatorSampleConsensus represents an implementation of the MSAC (M-estimator SAmple Consensus) algorithm, as described in: "MLESAC: A new robust estimator with application to estimating image geometry", P.H.S. More...

class  pcl::ProgressiveSampleConsensus< PointT >
RandomSampleConsensus represents an implementation of the RANSAC (RAndom SAmple Consensus) algorithm, as described in: "Matching with PROSAC – Progressive Sample Consensus", Chum, O. More...

class  pcl::RandomSampleConsensus< PointT >
RandomSampleConsensus represents an implementation of the RANSAC (RANdom SAmple Consensus) algorithm, as described in: "Random Sample Consensus: A Paradigm for Model Fitting with Applications to Image Analysis and Automated Cartography", Martin A. More...

class  pcl::RandomizedMEstimatorSampleConsensus< PointT >
RandomizedMEstimatorSampleConsensus represents an implementation of the RMSAC (Randomized M-estimator SAmple Consensus) algorithm, which basically adds a Td,d test (see RandomizedRandomSampleConsensus) to an MSAC estimator (see MEstimatorSampleConsensus). More...

class  pcl::RandomizedRandomSampleConsensus< PointT >
RandomizedRandomSampleConsensus represents an implementation of the RRANSAC (Randomized RAndom SAmple Consensus), as described in "Randomized RANSAC with Td,d test", O. More...

class  pcl::SampleConsensus< T >
SampleConsensus represents the base class. More...

class  pcl::SampleConsensusModel< PointT >
SampleConsensusModel represents the base model class. More...

class  pcl::SampleConsensusModelCircle2D< PointT >
SampleConsensusModelCircle2D defines a model for 2D circle segmentation on the X-Y plane. More...

class  pcl::SampleConsensusModelCircle3D< PointT >
SampleConsensusModelCircle3D defines a model for 3D circle segmentation. More...

class  pcl::SampleConsensusModelCone< PointT, PointNT >
SampleConsensusModelCone defines a model for 3D cone segmentation. More...

class  pcl::SampleConsensusModelCylinder< PointT, PointNT >
SampleConsensusModelCylinder defines a model for 3D cylinder segmentation. More...

class  pcl::SampleConsensusModelLine< PointT >
SampleConsensusModelLine defines a model for 3D line segmentation. More...

class  pcl::SampleConsensusModelNormalParallelPlane< PointT, PointNT >
SampleConsensusModelNormalParallelPlane defines a model for 3D plane segmentation using additional surface normal constraints. More...

class  pcl::SampleConsensusModelNormalPlane< PointT, PointNT >
SampleConsensusModelNormalPlane defines a model for 3D plane segmentation using additional surface normal constraints. More...

class  pcl::SampleConsensusModelNormalSphere< PointT, PointNT >
SampleConsensusModelNormalSphere defines a model for 3D sphere segmentation using additional surface normal constraints. More...

class  pcl::SampleConsensusModelParallelLine< PointT >
SampleConsensusModelParallelLine defines a model for 3D line segmentation using additional angular constraints. More...

class  pcl::SampleConsensusModelParallelPlane< PointT >
SampleConsensusModelParallelPlane defines a model for 3D plane segmentation using additional angular constraints. More...

class  pcl::SampleConsensusModelPerpendicularPlane< PointT >
SampleConsensusModelPerpendicularPlane defines a model for 3D plane segmentation using additional angular constraints. More...

class  pcl::SampleConsensusModelPlane< PointT >
SampleConsensusModelPlane defines a model for 3D plane segmentation. More...

class  pcl::SampleConsensusModelRegistration< PointT >
SampleConsensusModelRegistration defines a model for Point-To-Point registration outlier rejection. More...

class  pcl::SampleConsensusModelRegistration2D< PointT >
SampleConsensusModelRegistration2D defines a model for Point-To-Point registration outlier rejection using distances between 2D pixels. More...

class  pcl::SampleConsensusModelSphere< PointT >
SampleConsensusModelSphere defines a model for 3D sphere segmentation. More...

class  pcl::SampleConsensusModelStick< PointT >
SampleConsensusModelStick defines a model for 3D stick segmentation. More...

## Functions

template<typename Point >
double pcl::pointToPlaneDistanceSigned (const Point &p, double a, double b, double c, double d)
Get the distance from a point to a plane (signed) defined by ax+by+cz+d=0. More...

template<typename Point >
double pcl::pointToPlaneDistanceSigned (const Point &p, const Eigen::Vector4f &plane_coefficients)
Get the distance from a point to a plane (signed) defined by ax+by+cz+d=0. More...

template<typename Point >
double pcl::pointToPlaneDistance (const Point &p, double a, double b, double c, double d)
Get the distance from a point to a plane (unsigned) defined by ax+by+cz+d=0. More...

template<typename Point >
double pcl::pointToPlaneDistance (const Point &p, const Eigen::Vector4f &plane_coefficients)
Get the distance from a point to a plane (unsigned) defined by ax+by+cz+d=0. More...

## ◆ pointToPlaneDistance() [1/2]

template<typename Point >
 double pcl::pointToPlaneDistance ( const Point & p, double a, double b, double c, double d )
inline

`#include <pcl/sample_consensus/sac_model_plane.h>`

Get the distance from a point to a plane (unsigned) defined by ax+by+cz+d=0.

Parameters
 p a point a the normalized a coefficient of a plane b the normalized b coefficient of a plane c the normalized c coefficient of a plane d the normalized d coefficient of a plane

Definition at line 107 of file sac_model_plane.h.

References pcl::pointToPlaneDistanceSigned().

## ◆ pointToPlaneDistance() [2/2]

template<typename Point >
 double pcl::pointToPlaneDistance ( const Point & p, const Eigen::Vector4f & plane_coefficients )
inline

`#include <pcl/sample_consensus/sac_model_plane.h>`

Get the distance from a point to a plane (unsigned) defined by ax+by+cz+d=0.

Parameters
 p a point plane_coefficients the normalized coefficients (a, b, c, d) of a plane

Definition at line 118 of file sac_model_plane.h.

References pcl::pointToPlaneDistanceSigned().

## ◆ pointToPlaneDistanceSigned() [1/2]

template<typename Point >
 double pcl::pointToPlaneDistanceSigned ( const Point & p, double a, double b, double c, double d )
inline

`#include <pcl/sample_consensus/sac_model_plane.h>`

Get the distance from a point to a plane (signed) defined by ax+by+cz+d=0.

Parameters
 p a point a the normalized a coefficient of a plane b the normalized b coefficient of a plane c the normalized c coefficient of a plane d the normalized d coefficient of a plane

Definition at line 82 of file sac_model_plane.h.

## ◆ pointToPlaneDistanceSigned() [2/2]

template<typename Point >
 double pcl::pointToPlaneDistanceSigned ( const Point & p, const Eigen::Vector4f & plane_coefficients )
inline

`#include <pcl/sample_consensus/sac_model_plane.h>`

Get the distance from a point to a plane (signed) defined by ax+by+cz+d=0.

Parameters
 p a point plane_coefficients the normalized coefficients (a, b, c, d) of a plane

Definition at line 93 of file sac_model_plane.h.