iLab Neuromorphic Robotics Toolkit  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nrt::ModelRegistration Class Reference

#include <nrt/PointCloud2/SampleConcensus/Models/ModelRegistration.H>

A model for performing point cloud registration.

This model estimates a rigid transform between two point clouds using a minimum number of points

Definition at line 51 of file ModelRegistration.H.

Inheritance diagram for nrt::ModelRegistration:
nrt::ModelBase nrt::TargetCloud nrt::SourceCloud

Public Member Functions

ModelBase::SampleValidFunction createDistanceValidation () const
 
 ModelRegistration (PointCloud2 const source, PointCloud2 const target, Optional< ModelBase::SampleValidFunction > func=OptionalEmpty, double inlierThreshold=std::numeric_limits< double >::max(), size_t sampleMaxIterations=1000, bool seedRandom=false)
 Constructor. More...
 
 ModelRegistration (PointCloud2 const source, Indices const sourceIndices, PointCloud2 const target, Indices const targetIndices, Optional< ModelBase::SampleValidFunction > func=OptionalEmpty, double inlierThreshold=std::numeric_limits< double >::max(), size_t sampleMaxIterations=1000, bool seedRandom=false)
 Constructor with subsets. More...
 
virtual ~ModelRegistration ()
 Virtual destructor.
 
virtual size_t getSampleSize () const
 Returns the minimum valid sample size for the model.
 
virtual VectorX computeModelCoefficients (Indices const sampleIndices) const
 Attempts to form a valid model from the points at the selected indices. More...
 
virtual VectorX optimizeModelCoefficients (Indices const inlierIndices, VectorX const &modelCoefficients) const
 Recomputes the model coefficients using the provided inlier indices. More...
 
virtual std::vector< double > getDistancesToModel (VectorX const &modelCoefficients) const
 Computes distances from transformed points to their correspondences.
 
virtual Indices selectWithinDistance (VectorX const &modelCoefficients) const
 
virtual int countWithinDistance (VectorX const &modelCoefficients) const
 Counts all of the points which respect the model coefficients that are inliers.
 
- Public Member Functions inherited from nrt::ModelBase
 ModelBase (PointCloud2 const source, SampleValidFunction func, double inlierThreshold=std::numeric_limits< double >::max(), size_t sampleMaxIterations=1000, bool seedRandom=false)
 Constructor with no subset. More...
 
 ModelBase (PointCloud2 const source, Indices const indices, SampleValidFunction func, double inlierThreshold=std::numeric_limits< double >::max(), size_t sampleMaxIterations=1000, bool seedRandom=false)
 Constructor with a subset. More...
 
virtual ~ModelBase ()
 Virtual destructor.
 
Indices getSamples () const
 
- Public Member Functions inherited from nrt::SourceCloud
 SourceCloud ()
 Initializes with no data.
 
 SourceCloud (PointCloud2 const cloud)
 Initializes with a point cloud and no subset.
 
 SourceCloud (PointCloud2 const cloud, Indices const indices)
 Initializes with a point cloud and a specific subset.
 
size_t getWorkingSize () const
 Returns the current working size of the Source. More...
 
- Public Member Functions inherited from nrt::TargetCloud
 TargetCloud ()
 Initializes with no data.
 
 TargetCloud (PointCloud2 const cloud)
 Initializes with a point cloud and no subset.
 
 TargetCloud (PointCloud2 const cloud, Indices const indices)
 Initializes with a point cloud and a specific subset.
 
size_t getWorkingSize () const
 Returns the current working size of the Source. More...
 

Protected Member Functions

double computeSampleDistanceThreshold () const
 Computes an optimal distance threshold for the current cloud.
 
std::unordered_map< size_t,
size_t > 
computeCorrespondenceMap () const
 Computes a correspondence mapping used internally.
 
bool isValid (VectorX const &coefs) const
 Check if some set of coefficients is valid to use.
 
- Protected Member Functions inherited from nrt::TargetCloud
void setCloud (PointCloud2 const cloud)
 Sets to use a specific cloud.
 
void setCloud (PointCloud2 const cloud, Indices const indices)
 Sets to sue a specific subset of a cloud.
 

Additional Inherited Members

- Public Types inherited from nrt::ModelBase
typedef std::shared_ptr
< ModelBase
SharedPtr
 Convenience typedef for shared ptr to this.
 
typedef std::function< bool(Indices
const &)> 
SampleValidFunction
 A function that returns true if a set of points returns a valid sample. More...
 
- Public Attributes inherited from nrt::SourceCloud
PointCloud2 cloud
 The source point cloud.
 
Indices indices
 The optional indices.
 
bool useSubset
 Whether we use a subset or not.
 
- Public Attributes inherited from nrt::TargetCloud
PointCloud2 cloud
 The source point cloud.
 
Indices indices
 The optional indices.
 
bool useSubset
 Whether we use a subset or not.
 
- Protected Attributes inherited from nrt::ModelBase
PointCloud2 itsCloud
 The input point cloud.
 
SampleValidFunction itsIsSampleValidFunction
 Evaluates whether a set of indices is valid.
 
const double itsInlierThreshold
 used during sample selection
 
const size_t itsSampleMaxIterations
 distance threshold for selection and counting
 
std::mt19937 itsRNG
 The random number generator.
 

Constructor & Destructor Documentation

nrt::ModelRegistration::ModelRegistration ( PointCloud2 const  source,
PointCloud2 const  target,
Optional< ModelBase::SampleValidFunction func = OptionalEmpty,
double  inlierThreshold = std::numeric_limits< double >::max(),
size_t  sampleMaxIterations = 1000,
bool  seedRandom = false 
)

Constructor.

Parameters
sourceThe source cloud
targetThe target cloud
funcThe evaluation optional function. Should return true if all points passed in allow for a valid registration.
inlierThresholdDistance threshold to use for select and countWithinDistance()
sampleMaxIterationsMaximum number of iterations to use during sample selection
seedRandomIf true, the random number generator will be seeded with the current time, otherwise it will always receive the same default seed
nrt::ModelRegistration::ModelRegistration ( PointCloud2 const  source,
Indices const  sourceIndices,
PointCloud2 const  target,
Indices const  targetIndices,
Optional< ModelBase::SampleValidFunction func = OptionalEmpty,
double  inlierThreshold = std::numeric_limits< double >::max(),
size_t  sampleMaxIterations = 1000,
bool  seedRandom = false 
)

Constructor with subsets.

Parameters
sourceThe source cloud
sourceIndicesSubset of the source to use
targetThe target cloud
targetIndicesSubset of the target to use
funcThe evaluation optional function. Should return true if all points passed in allow for a valid registration.
inlierThresholdDistance threshold to use for select and countWithinDistance()
sampleMaxIterationsMaximum number of iterations to use during sample selection
seedRandomIf true, the random number generator will be seeded with the current time, otherwise it will always receive the same default seed

Member Function Documentation

ModelBase::SampleValidFunction nrt::ModelRegistration::createDistanceValidation ( ) const

A validation function that returns true if all points chosen are sufficiently far away from each other (see computeSampleDistanceThreshold())

virtual VectorX nrt::ModelRegistration::computeModelCoefficients ( Indices const  sampleIndices) const
virtual

Attempts to form a valid model from the points at the selected indices.

Parameters
sampleIndicesThe valid indices (check with isSampleValid() ) to use
Returns
The coefficients for the model

Implements nrt::ModelBase.

virtual VectorX nrt::ModelRegistration::optimizeModelCoefficients ( Indices const  inlierIndices,
VectorX const &  modelCoefficients 
) const
virtual

Recomputes the model coefficients using the provided inlier indices.

This can be called after inliers have been computed to refine a solution

Parameters
inlierIndicesThe inlier indices
modelCoefficientsThe coefficients found via computeModelCoefficients()
Returns
The optimized set of model coefficients

Implements nrt::ModelBase.

virtual Indices nrt::ModelRegistration::selectWithinDistance ( VectorX const &  modelCoefficients) const
virtual

Selects all points from the input data set that are inliers under the model according to some threshold

Implements nrt::ModelBase.


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