Point Cloud Library (PCL) 1.15.1
Loading...
Searching...
No Matches
pcl::registration::CorrespondenceRejectorSampleConsensus< PointT > Class Template Reference

CorrespondenceRejectorSampleConsensus implements a correspondence rejection using Random Sample Consensus to identify inliers (and reject outliers). More...

#include <pcl/registration/correspondence_rejection_sample_consensus.h>

Inheritance diagram for pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >:

Public Types

using Ptr = shared_ptr<CorrespondenceRejectorSampleConsensus<PointT>>
using ConstPtr = shared_ptr<const CorrespondenceRejectorSampleConsensus<PointT>>
Public Types inherited from pcl::registration::CorrespondenceRejector
using Ptr = shared_ptr<CorrespondenceRejector>
using ConstPtr = shared_ptr<const CorrespondenceRejector>

Public Member Functions

 CorrespondenceRejectorSampleConsensus ()
 Empty constructor.
 ~CorrespondenceRejectorSampleConsensus () override=default
 Empty destructor.
void getRemainingCorrespondences (const pcl::Correspondences &original_correspondences, pcl::Correspondences &remaining_correspondences) override
 Get a list of valid correspondences after rejection from the original set of correspondences.
virtual void setInputSource (const PointCloudConstPtr &cloud)
 Provide a source point cloud dataset (must contain XYZ data!).
PointCloudConstPtr const getInputSource ()
 Get a pointer to the input point cloud dataset target.
virtual void setInputTarget (const PointCloudConstPtr &cloud)
 Provide a target point cloud dataset (must contain XYZ data!).
PointCloudConstPtr const getInputTarget ()
 Get a pointer to the input point cloud dataset target.
bool requiresSourcePoints () const override
 See if this rejector requires source points.
void setSourcePoints (pcl::PCLPointCloud2::ConstPtr cloud2) override
 Blob method for setting the source cloud.
bool requiresTargetPoints () const override
 See if this rejector requires a target cloud.
void setTargetPoints (pcl::PCLPointCloud2::ConstPtr cloud2) override
 Method for setting the target cloud.
void setInlierThreshold (double threshold)
 Set the maximum distance between corresponding points.
double getInlierThreshold ()
 Get the maximum distance between corresponding points.
void setMaximumIterations (int max_iterations)
 Set the maximum number of iterations.
int getMaximumIterations ()
 Get the maximum number of iterations.
Eigen::Matrix4f getBestTransformation ()
 Get the best transformation after RANSAC rejection.
void setRefineModel (const bool refine)
 Specify whether the model should be refined internally using the variance of the inliers.
bool getRefineModel () const
 Get the internal refine parameter value as set by the user using setRefineModel.
void getInliersIndices (pcl::Indices &inlier_indices)
 Get the inlier indices found by the correspondence rejector.
void setSaveInliers (bool s)
 Set whether to save inliers or not.
bool getSaveInliers ()
 Get whether the rejector is configured to save inliers.
const std::string & getClassName () const
 Get a string representation of the name of this class.
Public Member Functions inherited from pcl::registration::CorrespondenceRejector
 CorrespondenceRejector ()=default
 Empty constructor.
virtual ~CorrespondenceRejector ()=default
 Empty destructor.
virtual void setInputCorrespondences (const CorrespondencesConstPtr &correspondences)
 Provide a pointer to the vector of the input correspondences.
CorrespondencesConstPtr getInputCorrespondences ()
 Get a pointer to the vector of the input correspondences.
void getCorrespondences (pcl::Correspondences &correspondences)
 Run correspondence rejection.
void getRejectedQueryIndices (const pcl::Correspondences &correspondences, pcl::Indices &indices)
 Determine the indices of query points of correspondences that have been rejected, i.e., the difference between the input correspondences (set via setInputCorrespondences) and the given correspondence vector.
const std::string & getClassName () const
 Get a string representation of the name of this class.
virtual bool requiresSourceNormals () const
 See if this rejector requires source normals.
virtual void setSourceNormals (pcl::PCLPointCloud2::ConstPtr)
 Abstract method for setting the source normals.
virtual bool requiresTargetNormals () const
 See if this rejector requires target normals.
virtual void setTargetNormals (pcl::PCLPointCloud2::ConstPtr)
 Abstract method for setting the target normals.

Public Attributes

CorrespondencesConstPtr input_correspondences_
 The input correspondences.
std::string rejection_name_
 The name of the rejection method.

Protected Member Functions

void applyRejection (pcl::Correspondences &correspondences) override
 Apply the rejection algorithm.

Protected Attributes

double inlier_threshold_ {0.05}
int max_iterations_ {1000}
PointCloudConstPtr input_
PointCloudPtr input_transformed_
PointCloudConstPtr target_
Eigen::Matrix4f best_transformation_
bool refine_ {false}
pcl::Indices inlier_indices_
bool save_inliers_ {false}
Protected Attributes inherited from pcl::registration::CorrespondenceRejector
std::string rejection_name_ {}
 The name of the rejection method.
CorrespondencesConstPtr input_correspondences_
 The input correspondences.

Detailed Description

template<typename PointT>
class pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >

CorrespondenceRejectorSampleConsensus implements a correspondence rejection using Random Sample Consensus to identify inliers (and reject outliers).

Author
Dirk Holz

Definition at line 54 of file correspondence_rejection_sample_consensus.h.

Member Typedef Documentation

◆ ConstPtr

template<typename PointT>
using pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::ConstPtr = shared_ptr<const CorrespondenceRejectorSampleConsensus<PointT>>

Definition at line 65 of file correspondence_rejection_sample_consensus.h.

◆ Ptr

template<typename PointT>
using pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::Ptr = shared_ptr<CorrespondenceRejectorSampleConsensus<PointT>>

Definition at line 64 of file correspondence_rejection_sample_consensus.h.

Constructor & Destructor Documentation

◆ CorrespondenceRejectorSampleConsensus()

template<typename PointT>
pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::CorrespondenceRejectorSampleConsensus ( )
inline

Empty constructor.

Sets the inlier threshold to 5cm (0.05m), and the maximum number of iterations to 1000.

Definition at line 70 of file correspondence_rejection_sample_consensus.h.

References input_, input_transformed_, rejection_name_, and target_.

◆ ~CorrespondenceRejectorSampleConsensus()

Empty destructor.

Member Function Documentation

◆ applyRejection()

template<typename PointT>
void pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::applyRejection ( pcl::Correspondences & correspondences)
inlineoverrideprotectedvirtual

Apply the rejection algorithm.

Parameters
[out]correspondencesthe set of resultant correspondences.

Implements pcl::registration::CorrespondenceRejector.

Reimplemented in pcl::registration::CorrespondenceRejectorSampleConsensus2D< PointT >.

Definition at line 247 of file correspondence_rejection_sample_consensus.h.

References getRemainingCorrespondences(), and input_correspondences_.

◆ getBestTransformation()

template<typename PointT>
Eigen::Matrix4f pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::getBestTransformation ( )
inline

Get the best transformation after RANSAC rejection.

Returns
The homogeneous 4x4 transformation yielding the largest number of inliers.

Definition at line 193 of file correspondence_rejection_sample_consensus.h.

References best_transformation_.

Referenced by pcl::GeometricConsistencyGrouping< PointModelT, PointSceneT >::clusterCorrespondences(), and pcl::Hough3DGrouping< PointModelT, PointSceneT, PointModelRfT, PointSceneRfT >::clusterCorrespondences().

◆ getClassName()

template<typename PointT>
const std::string & pcl::registration::CorrespondenceRejector::getClassName ( ) const
inline

Get a string representation of the name of this class.

Definition at line 131 of file correspondence_rejection.h.

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

◆ getInliersIndices()

template<typename PointT>
void pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::getInliersIndices ( pcl::Indices & inlier_indices)
inline

Get the inlier indices found by the correspondence rejector.

This information is only saved if setSaveInliers(true) was called in advance.

Parameters
[out]inlier_indicesIndices for the inliers

Definition at line 221 of file correspondence_rejection_sample_consensus.h.

References inlier_indices_.

◆ getInlierThreshold()

template<typename PointT>
double pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::getInlierThreshold ( )
inline

Get the maximum distance between corresponding points.

Returns
Distance threshold in the same dimension as source and target data sets.

Definition at line 166 of file correspondence_rejection_sample_consensus.h.

References inlier_threshold_.

◆ getInputSource()

template<typename PointT>
PointCloudConstPtr const pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::getInputSource ( )
inline

Get a pointer to the input point cloud dataset target.

Definition at line 98 of file correspondence_rejection_sample_consensus.h.

References input_.

◆ getInputTarget()

template<typename PointT>
PointCloudConstPtr const pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::getInputTarget ( )
inline

Get a pointer to the input point cloud dataset target.

Definition at line 114 of file correspondence_rejection_sample_consensus.h.

References target_.

◆ getMaximumIterations()

template<typename PointT>
int pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::getMaximumIterations ( )
inline

Get the maximum number of iterations.

Returns
max_iterations Maximum number if iterations to run

Definition at line 184 of file correspondence_rejection_sample_consensus.h.

References max_iterations_.

◆ getRefineModel()

template<typename PointT>
bool pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::getRefineModel ( ) const
inline

Get the internal refine parameter value as set by the user using setRefineModel.

Definition at line 211 of file correspondence_rejection_sample_consensus.h.

References refine_.

◆ getRemainingCorrespondences()

template<typename PointT>
void pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::getRemainingCorrespondences ( const pcl::Correspondences & original_correspondences,
pcl::Correspondences & remaining_correspondences )
inlineoverridevirtual

◆ getSaveInliers()

template<typename PointT>
bool pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::getSaveInliers ( )
inline

Get whether the rejector is configured to save inliers.

Definition at line 237 of file correspondence_rejection_sample_consensus.h.

References save_inliers_.

◆ requiresSourcePoints()

template<typename PointT>
bool pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::requiresSourcePoints ( ) const
inlineoverridevirtual

See if this rejector requires source points.

Reimplemented from pcl::registration::CorrespondenceRejector.

Definition at line 121 of file correspondence_rejection_sample_consensus.h.

◆ requiresTargetPoints()

template<typename PointT>
bool pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::requiresTargetPoints ( ) const
inlineoverridevirtual

See if this rejector requires a target cloud.

Reimplemented from pcl::registration::CorrespondenceRejector.

Definition at line 137 of file correspondence_rejection_sample_consensus.h.

◆ setInlierThreshold()

template<typename PointT>
void pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::setInlierThreshold ( double threshold)
inline

Set the maximum distance between corresponding points.

Correspondences with distances below the threshold are considered as inliers.

Parameters
[in]thresholdDistance threshold in the same dimension as source and target data sets.

Definition at line 157 of file correspondence_rejection_sample_consensus.h.

References inlier_threshold_.

Referenced by pcl::GeometricConsistencyGrouping< PointModelT, PointSceneT >::clusterCorrespondences(), and pcl::Hough3DGrouping< PointModelT, PointSceneT, PointModelRfT, PointSceneRfT >::clusterCorrespondences().

◆ setInputSource()

template<typename PointT>
virtual void pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::setInputSource ( const PointCloudConstPtr & cloud)
inlinevirtual

Provide a source point cloud dataset (must contain XYZ data!).

Parameters
[in]clouda cloud containing XYZ data

Definition at line 91 of file correspondence_rejection_sample_consensus.h.

References input_.

Referenced by pcl::GeometricConsistencyGrouping< PointModelT, PointSceneT >::clusterCorrespondences(), pcl::Hough3DGrouping< PointModelT, PointSceneT, PointModelRfT, PointSceneRfT >::clusterCorrespondences(), and setSourcePoints().

◆ setInputTarget()

template<typename PointT>
virtual void pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::setInputTarget ( const PointCloudConstPtr & cloud)
inlinevirtual

Provide a target point cloud dataset (must contain XYZ data!).

Parameters
[in]clouda cloud containing XYZ data

Definition at line 107 of file correspondence_rejection_sample_consensus.h.

References target_.

Referenced by pcl::GeometricConsistencyGrouping< PointModelT, PointSceneT >::clusterCorrespondences(), pcl::Hough3DGrouping< PointModelT, PointSceneT, PointModelRfT, PointSceneRfT >::clusterCorrespondences(), and setTargetPoints().

◆ setMaximumIterations()

template<typename PointT>
void pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::setMaximumIterations ( int max_iterations)
inline

Set the maximum number of iterations.

Parameters
[in]max_iterationsMaximum number if iterations to run

Definition at line 175 of file correspondence_rejection_sample_consensus.h.

References max_iterations_.

Referenced by pcl::GeometricConsistencyGrouping< PointModelT, PointSceneT >::clusterCorrespondences(), and pcl::Hough3DGrouping< PointModelT, PointSceneT, PointModelRfT, PointSceneRfT >::clusterCorrespondences().

◆ setRefineModel()

template<typename PointT>
void pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::setRefineModel ( const bool refine)
inline

Specify whether the model should be refined internally using the variance of the inliers.

Parameters
[in]refinetrue if the model should be refined, false otherwise

Definition at line 203 of file correspondence_rejection_sample_consensus.h.

References refine_.

◆ setSaveInliers()

template<typename PointT>
void pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::setSaveInliers ( bool s)
inline

Set whether to save inliers or not.

Parameters
[in]sTrue to save inliers / False otherwise

Definition at line 230 of file correspondence_rejection_sample_consensus.h.

References save_inliers_.

◆ setSourcePoints()

template<typename PointT>
void pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::setSourcePoints ( pcl::PCLPointCloud2::ConstPtr cloud2)
inlineoverridevirtual

Blob method for setting the source cloud.

Reimplemented from pcl::registration::CorrespondenceRejector.

Definition at line 128 of file correspondence_rejection_sample_consensus.h.

References pcl::fromPCLPointCloud2(), and setInputSource().

◆ setTargetPoints()

template<typename PointT>
void pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::setTargetPoints ( pcl::PCLPointCloud2::ConstPtr cloud2)
inlineoverridevirtual

Method for setting the target cloud.

Reimplemented from pcl::registration::CorrespondenceRejector.

Definition at line 144 of file correspondence_rejection_sample_consensus.h.

References pcl::fromPCLPointCloud2(), and setInputTarget().

Member Data Documentation

◆ best_transformation_

◆ inlier_indices_

template<typename PointT>
pcl::Indices pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::inlier_indices_
protected

◆ inlier_threshold_

◆ input_

◆ input_correspondences_

◆ input_transformed_

template<typename PointT>
PointCloudPtr pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::input_transformed_
protected

◆ max_iterations_

◆ refine_

◆ rejection_name_

◆ save_inliers_

template<typename PointT>
bool pcl::registration::CorrespondenceRejectorSampleConsensus< PointT >::save_inliers_ {false}
protected

◆ target_


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