pcl::SampleConsensusModelRegistration2D< PointT > Class Template Reference
Module sample_consensus

SampleConsensusModelRegistration2D defines a model for Point-To-Point registration outlier rejection using distances between 2D pixels. More...

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

Inheritance diagram for pcl::SampleConsensusModelRegistration2D< PointT >:

## Public Types

using | PointCloud = typename pcl::SampleConsensusModel< PointT >::PointCloud
using | PointCloudPtr = typename pcl::SampleConsensusModel< PointT >::PointCloudPtr
using | PointCloudConstPtr = typename pcl::SampleConsensusModel< PointT >::PointCloudConstPtr
using | Ptr = shared_ptr< SampleConsensusModelRegistration2D< PointT > >
using | ConstPtr = shared_ptr< const SampleConsensusModelRegistration2D< PointT > >
Public Types inherited from pcl::SampleConsensusModelRegistration< PointT >
using | PointCloud = typename SampleConsensusModel< PointT >::PointCloud
using | PointCloudPtr = typename SampleConsensusModel< PointT >::PointCloudPtr
using | PointCloudConstPtr = typename SampleConsensusModel< PointT >::PointCloudConstPtr
using | Ptr = shared_ptr< SampleConsensusModelRegistration< PointT > >
using | ConstPtr = shared_ptr< const SampleConsensusModelRegistration< PointT > >
Public Types inherited from pcl::SampleConsensusModel< PointT >
using | PointCloud = pcl::PointCloud< PointT >
using | PointCloudConstPtr = typename PointCloud::ConstPtr
using | PointCloudPtr = typename PointCloud::Ptr
using | SearchPtr = typename pcl::search::Search< PointT >::Ptr
using | Ptr = shared_ptr< SampleConsensusModel< PointT > >
using | ConstPtr = shared_ptr< const SampleConsensusModel< PointT > >

## Public Member Functions

| SampleConsensusModelRegistration2D (const PointCloudConstPtr &cloud, bool random=false)
| Constructor for base SampleConsensusModelRegistration2D. More...
| SampleConsensusModelRegistration2D (const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false)
| Constructor for base SampleConsensusModelRegistration2D. More...
virtual | ~SampleConsensusModelRegistration2D ()
| Empty destructor. More...
void | getDistancesToModel (const Eigen::VectorXf &model_coefficients, std::vector< double > &distances) const
| Compute all distances from the transformed points to their correspondences. More...
void | selectWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold, std::vector< int > &inliers)
| Select all the points which respect the given model coefficients as inliers. More...
virtual std::size_t | countWithinDistance (const Eigen::VectorXf &model_coefficients, const double threshold) const
| Count all the points which respect the given model coefficients as inliers. More...
void | setProjectionMatrix (const Eigen::Matrix3f &projection_matrix)
| Set the camera projection matrix. More...
Eigen::Matrix3f | getProjectionMatrix () const
| Get the camera projection matrix. More...
Public Member Functions inherited from pcl::SampleConsensusModelRegistration< PointT >
| SampleConsensusModelRegistration (const PointCloudConstPtr &cloud, bool random=false)
| Constructor for base SampleConsensusModelRegistration. More...
| SampleConsensusModelRegistration (const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false)
| Constructor for base SampleConsensusModelRegistration. More...
| ~SampleConsensusModelRegistration ()
| Empty destructor. More...
void | setInputCloud (const PointCloudConstPtr &cloud) override
| Provide a pointer to the input dataset. More...
void | setInputTarget (const PointCloudConstPtr &target)
| Set the input point cloud target. More...
void | setInputTarget (const PointCloudConstPtr &target, const std::vector< int > &indices_tgt)
| Set the input point cloud target. More...
bool | computeModelCoefficients (const std::vector< int > &samples, Eigen::VectorXf &model_coefficients) const override
| Compute a 4x4 rigid transformation matrix from the samples given. More...
void | optimizeModelCoefficients (const std::vector< int > &inliers, const Eigen::VectorXf &model_coefficients, Eigen::VectorXf &optimized_coefficients) const override
| Recompute the 4x4 transformation using the given inlier set. More...
void | projectPoints (const std::vector< int > &, const Eigen::VectorXf &, PointCloud &, bool=true) const override
| Create a new point cloud with inliers projected onto the model. More...
bool | doSamplesVerifyModel (const std::set< int > &, const Eigen::VectorXf &, const double) const override
| Verify whether a subset of indices verifies a given set of model coefficients. More...
pcl::SacModel | getModelType () const override
| Return a unique id for this model (SACMODEL_REGISTRATION). More...
Public Member Functions inherited from pcl::SampleConsensusModel< PointT >
| SampleConsensusModel (const PointCloudConstPtr &cloud, bool random=false)
| Constructor for base SampleConsensusModel. More...
| SampleConsensusModel (const PointCloudConstPtr &cloud, const std::vector< int > &indices, bool random=false)
| Constructor for base SampleConsensusModel. More...
virtual | ~SampleConsensusModel ()
| Destructor for base SampleConsensusModel. More...
virtual void | getSamples (int &iterations, std::vector< int > &samples)
| Get a set of random data samples and return them as point indices. More...
virtual void | setInputCloud (const PointCloudConstPtr &cloud)
| Provide a pointer to the input dataset. More...
PointCloudConstPtr | getInputCloud () const
| Get a pointer to the input point cloud dataset. More...
void | setIndices (const IndicesPtr &indices)
| Provide a pointer to the vector of indices that represents the input data. More...
void | setIndices (const std::vector< int > &indices)
| Provide the vector of indices that represents the input data. More...
IndicesPtr | getIndices () const
| Get a pointer to the vector of indices used. More...
const std::string & | getClassName () const
| Get a string representation of the name of this class. More...
unsigned int | getSampleSize () const
| Return the size of a sample from which the model is computed. More...
unsigned int | getModelSize () const
| Return the number of coefficients in the model. More...
void | setRadiusLimits (const double &min_radius, const double &max_radius)
| Set the minimum and maximum allowable radius limits for the model (applicable to models that estimate a radius) More...
void | getRadiusLimits (double &min_radius, double &max_radius) const
| Get the minimum and maximum allowable radius limits for the model as set by the user. More...
void | setSamplesMaxDist (const double &radius, SearchPtr search)
| Set the maximum distance allowed when drawing random samples. More...
void | getSamplesMaxDist (double &radius) const
| Get maximum distance allowed when drawing random samples. More...
double | computeVariance (const std::vector< double > &error_sqr_dists) const
| Compute the variance of the errors to the model. More...
double | computeVariance () const
| Compute the variance of the errors to the model from the internally estimated vector of distances. More...

## Protected Member Functions

bool | isSampleGood (const std::vector< int > &samples) const
| Check if a sample of indices results in a good sample of points indices. More...
void | computeSampleDistanceThreshold (const PointCloudConstPtr &)
| Computes an "optimal" sample distance threshold based on the principal directions of the input cloud. More...
void | computeSampleDistanceThreshold (const PointCloudConstPtr &, const std::vector< int > &)
| Computes an "optimal" sample distance threshold based on the principal directions of the input cloud. More...
Protected Member Functions inherited from pcl::SampleConsensusModelRegistration< PointT >
void | computeSampleDistanceThreshold (const PointCloudConstPtr &cloud)
| Computes an "optimal" sample distance threshold based on the principal directions of the input cloud. More...
void | computeSampleDistanceThreshold (const PointCloudConstPtr &cloud, const std::vector< int > &indices)
| Computes an "optimal" sample distance threshold based on the principal directions of the input cloud. More...
void | estimateRigidTransformationSVD (const pcl::PointCloud< PointT > &cloud_src, const std::vector< int > &indices_src, const pcl::PointCloud< PointT > &cloud_tgt, const std::vector< int > &indices_tgt, Eigen::VectorXf &transform) const
| Estimate a rigid transformation between a source and a target point cloud using an SVD closed-form solution of absolute orientation using unit quaternions. More...
void | computeOriginalIndexMapping ()
| Compute mappings between original indices of the input_/target_ clouds. More...
Protected Member Functions inherited from pcl::SampleConsensusModel< PointT >
| SampleConsensusModel (bool random=false)
| Empty constructor for base SampleConsensusModel. More...
void | drawIndexSample (std::vector< int > &sample)
| Fills a sample array with random samples from the indices_ vector. More...
void | drawIndexSampleRadius (std::vector< int > &sample)
| Fills a sample array with one random sample from the indices_ vector and other random samples that are closer than samples_radius_. More...
virtual bool | isModelValid (const Eigen::VectorXf &model_coefficients) const
| Check whether a model is valid given the user constraints. More...
int | rnd ()
| Boost-based random number generator. More...

## Additional Inherited Members

Protected Attributes inherited from pcl::SampleConsensusModelRegistration< PointT >
PointCloudConstPtr | target_
| A boost shared pointer to the target point cloud data array. More...
IndicesPtr | indices_tgt_
| A pointer to the vector of target point indices to use. More...
std::map< int, int > | correspondences_
| Given the index in the original point cloud, give the matching original index in the target cloud. More...
double | sample_dist_thresh_
| Internal distance threshold used for the sample selection step. More...
Protected Attributes inherited from pcl::SampleConsensusModel< PointT >
std::string | model_name_
| The model name. More...
PointCloudConstPtr | input_
| A boost shared pointer to the point cloud data array. More...
IndicesPtr | indices_
| A pointer to the vector of point indices to use. More...
double | radius_min_
| The minimum and maximum radius limits for the model. More...
double | radius_max_
double | samples_radius_
| The maximum distance of subsequent samples from the first (radius search) More...
SearchPtr | samples_radius_search_
| The search object for picking subsequent samples using radius search. More...
std::vector< int > | shuffled_indices_
| Data containing a shuffled version of the indices. More...
boost::mt19937 | rng_alg_
| Boost-based random number generator algorithm. More...
std::shared_ptr< boost::uniform_int<> > | rng_dist_
| Boost-based random number generator distribution. More...
std::shared_ptr< boost::variate_generator< boost::mt19937 &, boost::uniform_int<> > > | rng_gen_
| Boost-based random number generator. More...
std::vector< double > | error_sqr_dists_
| A vector holding the distances to the computed model. More...
unsigned int | sample_size_
| The size of a sample from which the model is computed. More...
unsigned int | model_size_
| The number of coefficients in the model. More...
Static Protected Attributes inherited from pcl::SampleConsensusModel< PointT >
static const unsigned int | max_sample_checks_ = 1000
| The maximum number of samples to try until we get a good one. More...

## Detailed Description

### template<typename PointT>
class pcl::SampleConsensusModelRegistration2D< PointT >

SampleConsensusModelRegistration2D defines a model for Point-To-Point registration outlier rejection using distances between 2D pixels.

Author
  Radu B. Rusu

Definition at line 51 of file sac_model_registration_2d.h.

## Member Typedef Documentation

## ConstPtr

template<typename PointT>

using pcl::SampleConsensusModelRegistration2D< PointT >::ConstPtr = shared_ptr<const SampleConsensusModelRegistration2D<PointT> >

Definition at line 70 of file sac_model_registration_2d.h.

## PointCloud

template<typename PointT>

using pcl::SampleConsensusModelRegistration2D< PointT >::PointCloud = typename pcl::SampleConsensusModel<PointT>::PointCloud

Definition at line 65 of file sac_model_registration_2d.h.

## PointCloudConstPtr

template<typename PointT>

using pcl::SampleConsensusModelRegistration2D< PointT >::PointCloudConstPtr = typename pcl::SampleConsensusModel<PointT>::PointCloudConstPtr

Definition at line 67 of file sac_model_registration_2d.h.

## PointCloudPtr

template<typename PointT>

using pcl::SampleConsensusModelRegistration2D< PointT >::PointCloudPtr = typename pcl::SampleConsensusModel<PointT>::PointCloudPtr

Definition at line 66 of file sac_model_registration_2d.h.

## Ptr

template<typename PointT>

using pcl::SampleConsensusModelRegistration2D< PointT >::Ptr = shared_ptr<SampleConsensusModelRegistration2D<PointT> >

Definition at line 69 of file sac_model_registration_2d.h.

## Constructor & Destructor Documentation

## SampleConsensusModelRegistration2D() [1/2]

template<typename PointT>

pcl::SampleConsensusModelRegistration2D< PointT >::SampleConsensusModelRegistration2D | ( | const PointCloudConstPtr & | cloud,
|  | bool | random = `false`
| ) |  |

inline

Constructor for base SampleConsensusModelRegistration2D.

Parameters

  [in] | cloud | the input point cloud dataset
  [in] | random | if true set the random seed to the current time, else set to 12345 (default: false)

Definition at line 76 of file sac_model_registration_2d.h.

References pcl::SampleConsensusModel< PointT >::model_name_, pcl::SampleConsensusModel< PointT >::model_size_, pcl::SampleConsensusModel< PointT >::sample_size_, and pcl::SampleConsensusModelRegistration< PointT >::setInputCloud().

## SampleConsensusModelRegistration2D() [2/2]

template<typename PointT>

pcl::SampleConsensusModelRegistration2D< PointT >::SampleConsensusModelRegistration2D | ( | const PointCloudConstPtr & | cloud,
|  | const std::vector< int > & | indices,
|  | bool | random = `false`
| ) |  |

inline

Constructor for base SampleConsensusModelRegistration2D.

Parameters

  [in] | cloud | the input point cloud dataset
  [in] | indices | a vector of point indices to be used from cloud
  [in] | random | if true set the random seed to the current time, else set to 12345 (default: false)

Definition at line 93 of file sac_model_registration_2d.h.

References pcl::SampleConsensusModelRegistration< PointT >::computeOriginalIndexMapping(), pcl::SampleConsensusModelRegistration2D< PointT >::computeSampleDistanceThreshold(), pcl::SampleConsensusModel< PointT >::model_name_, pcl::SampleConsensusModel< PointT >::model_size_, and pcl::SampleConsensusModel< PointT >::sample_size_.

## ~SampleConsensusModelRegistration2D()

template<typename PointT>

virtual pcl::SampleConsensusModelRegistration2D< PointT >::~SampleConsensusModelRegistration2D | ( |  | ) |

inline virtual

Empty destructor.

Definition at line 107 of file sac_model_registration_2d.h.

## Member Function Documentation

## computeSampleDistanceThreshold() [1/2]

template<typename PointT>

void pcl::SampleConsensusModelRegistration2D< PointT >::computeSampleDistanceThreshold | ( | const PointCloudConstPtr & |  | ) |

inline protected

Computes an "optimal" sample distance threshold based on the principal directions of the input cloud.

Definition at line 164 of file sac_model_registration_2d.h.

Referenced by pcl::SampleConsensusModelRegistration2D< PointT >::SampleConsensusModelRegistration2D().

## computeSampleDistanceThreshold() [2/2]

template<typename PointT>

void pcl::SampleConsensusModelRegistration2D< PointT >::computeSampleDistanceThreshold | ( | const PointCloudConstPtr & | ,
|  | const std::vector< int > & |
| ) |  |

inline protected

Computes an "optimal" sample distance threshold based on the principal directions of the input cloud.

Definition at line 191 of file sac_model_registration_2d.h.

## countWithinDistance()

template<typename PointT >

std::size_t pcl::SampleConsensusModelRegistration2D< PointT >::countWithinDistance | ( | const Eigen::VectorXf & | model_coefficients,
|  | const double | threshold
| ) |  | const

virtual

Count all the points which respect the given model coefficients as inliers.

Parameters

  [in] | model_coefficients | the coefficients of a model that we need to compute distances to
  [in] | threshold | maximum admissible distance threshold for determining the inliers from the outliers

Returns
  the resultant number of inliers

Reimplemented from pcl::SampleConsensusModelRegistration< PointT >.

Definition at line 178 of file sac_model_registration_2d.hpp.

## getDistancesToModel()

template<typename PointT >

void pcl::SampleConsensusModelRegistration2D< PointT >::getDistancesToModel | ( | const Eigen::VectorXf & | model_coefficients,
|  | std::vector< double > & | distances
| ) |  | const

virtual

Compute all distances from the transformed points to their correspondences.

Parameters

  [in] | model_coefficients | the 4x4 transformation matrix
  [out] | distances | the resultant estimated distances

Reimplemented from pcl::SampleConsensusModelRegistration< PointT >.

Definition at line 64 of file sac_model_registration_2d.hpp.

## getProjectionMatrix()

template<typename PointT>

Eigen::Matrix3f pcl::SampleConsensusModelRegistration2D< PointT >::getProjectionMatrix | ( |  | ) | const

inline

Get the camera projection matrix.

Definition at line 146 of file sac_model_registration_2d.h.

## isSampleGood()

template<typename PointT >

bool pcl::SampleConsensusModelRegistration2D< PointT >::isSampleGood | ( | const std::vector< int > & | samples | ) | const

protected virtual

Check if a sample of indices results in a good sample of points indices.

Parameters

  [in] | samples | the resultant index samples

Reimplemented from pcl::SampleConsensusModelRegistration< PointT >.

Definition at line 47 of file sac_model_registration_2d.hpp.

## selectWithinDistance()

template<typename PointT >

void pcl::SampleConsensusModelRegistration2D< PointT >::selectWithinDistance | ( | const Eigen::VectorXf & | model_coefficients,
|  | const double | threshold,
|  | std::vector< int > & | inliers
| ) |  |

virtual

Select all the points which respect the given model coefficients as inliers.

Parameters

  [in] | model_coefficients | the 4x4 transformation matrix
  [in] | threshold | a maximum admissible distance threshold for determining the inliers from the outliers
  [out] | inliers | the resultant model inliers

Reimplemented from pcl::SampleConsensusModelRegistration< PointT >.

Definition at line 116 of file sac_model_registration_2d.hpp.

References pcl::geometry::distance().

## setProjectionMatrix()

template<typename PointT>

void pcl::SampleConsensusModelRegistration2D< PointT >::setProjectionMatrix | ( | const Eigen::Matrix3f & | projection_matrix | ) |

inline

Set the camera projection matrix.

Parameters

  [in] | projection_matrix | the camera projection matrix

Definition at line 141 of file sac_model_registration_2d.h.

Referenced by pcl::registration::CorrespondenceRejectorSampleConsensus2D< PointT >::getRemainingCorrespondences().

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

- pcl/sample_consensus/sac_model_registration_2d.h
- pcl/sample_consensus/impl/sac_model_registration_2d.hpp