gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts > Class Template Referenceabstract

Base class for Congruent Sec Exploration algorithms. More...

#include <congruentSetExplorationBase.h>

+ Inheritance diagram for gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >:
+ Collaboration diagram for gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >:

Public Types

using CongruentBaseType = typename Traits::Base
 
using Coordinates = typename Traits::Coordinates
 
using LogLevel = typename MatchBaseType::LogLevel
 
using MatchBaseType = MatchBase< _PointType, _TransformVisitor, OptExts..., CongruentSetExplorationOptions >
 
using MatrixType = typename MatchBaseType::MatrixType
 
using OptionsType = typename MatchBaseType::OptionsType
 
using PairFilteringFunctor = _PairFilteringFunctor
 
using PairsVector = std::vector< std::pair< int, int > >
 
using PosMutablePoint = typename MatchBaseType::PosMutablePoint
 
using RegistrationMetric = Utils::LCPMetric< Scalar >
 
using Scalar = typename MatchBaseType::Scalar
 
using Set = typename Traits::Set
 
using Traits = _Traits
 
using TransformVisitor = _TransformVisitor
 
using VectorType = typename MatchBaseType::VectorType
 
- Public Types inherited from gr::MatchBase< _PointType, _TransformVisitor, OptExts..., CongruentSetExplorationOptions >
using LogLevel = Utils::LogLevel
 
using MatrixType = Eigen::Matrix< Scalar, 4, 4 >
 
using OptionsType = gr::Utils::CRTP< OptExts......, Options >
 
using Scalar = typename _PointType::Scalar
 
using TransformVisitor = _TransformVisitor
 
using VectorType = typename _PointType::VectorType
 

Public Member Functions

template<typename InputRange1 , typename InputRange2 , template< typename > class Sampler>
CongruentSetExplorationBase< Traits, PointType, TransformVisitor, PairFilteringFunctor, OptExts... >::Scalar ComputeTransformation (const InputRange1 &P, const InputRange2 &Q, Eigen::Ref< typename CongruentSetExplorationBase< Traits, PointType, TransformVisitor, PairFilteringFunctor, OptExts... >::MatrixType > transformation, const Sampler< PointType > &sampler, TransformVisitor &v)
 
template<typename InputRange1 , typename InputRange2 , template< typename > class Sampler>
Scalar ComputeTransformation (const InputRange1 &P, const InputRange2 &Q, Eigen::Ref< MatrixType > transformation, const Sampler< _PointType > &sampler, TransformVisitor &v)
 Computes an approximation of the best LCP (directional) from Q to P and the rigid transformation that realizes it. The input sets may or may not contain normal information for any point. More...
 
EIGEN_MAKE_ALIGNED_OPERATOR_NEW CongruentSetExplorationBase (const OptionsType &options, const Utils::Logger &logger)
 
virtual bool initBase (CongruentBaseType &base)=0
 Tries to compute an inital base from P. More...
 
virtual ~CongruentSetExplorationBase ()
 
- Public Member Functions inherited from gr::MatchBase< _PointType, _TransformVisitor, OptExts..., CongruentSetExplorationOptions >
Scalar ComputeTransformation (const InputRange1 &P, const InputRange2 &Q, Eigen::Ref< MatrixType > transformation, const Sampler< _PointType > &sampler, TransformVisitor &v)
 Computes an approximation of the best LCP (directional) from Q to P and the rigid transformation that realizes it. The input sets may or may not contain normal information for any point. More...
 
const std::vector< PosMutablePoint > & getFirstSampled () const
 Read access to the sampled clouds used for the registration. More...
 
const std::vector< PosMutablePoint > & getSecondSampled () const
 Read access to the sampled clouds used for the registration. More...
 
EIGEN_MAKE_ALIGNED_OPERATOR_NEW MatchBase (const OptionsType &options, const Utils::Logger &logger)
 
virtual ~MatchBase ()
 

Static Public Attributes

static constexpr Scalar distance_factor = 2.0
 
static constexpr Scalar kLargeNumber = 1e9
 

Protected Member Functions

const CongruentBaseTypebase3D () const
 
virtual bool generateCongruents (CongruentBaseType &base, Set &congruent_set)=0
 Find all the congruent set similar to the base in the second 3D model (Q). It could be with a 3 point base or a 4 point base. More...
 
bool Perform_N_steps (int n, Eigen::Ref< MatrixType > transformation, TransformVisitor &v)
 Performs n RANSAC iterations, each one of them containing base selection, finding congruent sets and verification. Returns true if the process can be terminated (the target LCP was obtained or the maximum number of trials has been reached), false otherwise. More...
 
bool TryCongruentSet (CongruentBaseType &base, Set &set, TransformVisitor &v, size_t &nbCongruent)
 Loop over the set of congruent 4-points and test the compatibility with the input base. More...
 
bool TryOneBase (TransformVisitor &v)
 Tries one base and finds the best transformation for this base. Returns true if the achieved LCP is greater than terminate_threshold_, else otherwise. More...
 
Scalar Verify (const Eigen::Ref< const MatrixType > &mat) const
 For each randomly picked base, verifies the computed transformation by computing the number of points that this transformation brings near points in Q. Returns the current LCP. R is the rotation matrix, (tx,ty,tz) is the translation vector and (cx,cy,cz) is the center of transformation.template <class matrixderived>=""> More...
 
- Protected Member Functions inherited from gr::MatchBase< _PointType, _TransformVisitor, OptExts..., CongruentSetExplorationOptions >
bool ComputeRigidTransformation (const Coordinates &ref, const Coordinates &candidate, const Eigen::Matrix< Scalar, 3, 1 > &centroid1, Eigen::Matrix< Scalar, 3, 1 > centroid2, Eigen::Ref< MatrixType > transform, Scalar &rms_, bool computeScale) const
 Computes the best rigid transformation between three corresponding pairs. The transformation is characterized by rotation matrix, translation vector and a center about which we rotate. The set of pairs is potentially being updated by the best permutation of the second set. Returns the RMS of the fit. The method is being called with n points but it applies the fit for only 3 after the best permutation is selected in the second set (see bellow). This is done because the solution for planar points is much simpler. The method is the closed-form solution by Horn: people.csail.mit.edu/bkph/papers/Absolute_Orientation.pdf. More...
 
void init (const InputRange1 &P, const InputRange2 &Q, const Sampler< _PointType > &sampler)
 Initializes the internal state of the Base class. More...
 
virtual void Initialize ()
 Initializes the data structures and needed values before the match computation. This method is called once the internal state of the Base class as been set. More...
 
void Log (Args...args) const
 
Scalar MeanDistance () const
 Computes the mean distance between points in Q and their nearest neighbor. We need this for normalization of the user delta (See the paper) to the "scale" of the set. More...
 
bool SelectRandomTriangle (Scalar max_base_diameter, int &base1, int &base2, int &base3)
 Selects a random triangle in the set P (then we add another point to keep the base as planar as possible). We apply a simple heuristic that works in most practical cases. The idea is to accept maximum distance, computed by the estimated overlap, multiplied by the diameter of P, and try to have a triangle with all three edges close to this distance. Wide triangles helps to make the transformation robust while too large triangles makes the probability of having all points in the inliers small so we try to trade-off. More...
 

Protected Attributes

CongruentBaseType base_
 The points in the base (indices to P). It is being updated in every RANSAC iteration. More...
 
Coordinates base_3D_
 The 3D points of the base. More...
 
Scalar best_LCP_
 The best LCP (Largest Common Point) fraction so far. More...
 
CongruentBaseType current_congruent_
 The current congruent 4 points from Q. Every RANSAC iteration the algorithm examines a set of such congruent 4-points from Q and retains the best from them (the one that realizes the best LCP). More...
 
int current_trial_
 Current trial. More...
 
Scalar max_base_diameter_ {Scalar( -1 )}
 Maximum base diameter. It is computed automatically from the diameter of P and the estimated overlap and used to limit the distance between the points in the base in P so that the probability to have all points in the base as inliers is increased. More...
 
int number_of_trials_
 Number of trials. Every trial picks random base from P. More...
 
- Protected Attributes inherited from gr::MatchBase< _PointType, _TransformVisitor, OptExts..., CongruentSetExplorationOptions >
VectorType centroid_P_
 The centroid of P. More...
 
VectorType centroid_Q_
 The centroid of Q. More...
 
KdTree< Scalarkd_tree_
 KdTree used to compute the LCP. More...
 
const Utils::Loggerlogger_
 
OptionsType options_
 
Scalar P_diameter_
 The diameter of P. More...
 
Scalar P_mean_distance_
 Mean distance between points and their nearest neighbor in the set P. Used to normalize the "delta" which is given in terms of this distance. More...
 
VectorType qcentroid1_
 
VectorType qcentroid2_
 
std::mt19937 randomGenerator_
 
std::vector< PosMutablePoint > sampled_P_3D_
 Sampled P (3D coordinates). More...
 
std::vector< PosMutablePoint > sampled_Q_3D_
 Sampled Q (3D coordinates). More...
 
Eigen::Matrix< Scalar, 4, 4 > transform_
 The transformation matrix by wich we transform Q to P. More...
 

Additional Inherited Members

- Static Protected Attributes inherited from gr::MatchBase< _PointType, _TransformVisitor, OptExts..., CongruentSetExplorationOptions >
static constexpr int kNumberOfDiameterTrials
 

Detailed Description

template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
class gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >

Base class for Congruent Sec Exploration algorithms.

Template Parameters
_TraitsDefines properties of the Base used to build the congruent set.

Member Typedef Documentation

template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
using gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::CongruentBaseType = typename Traits::Base
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
using gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::Coordinates = typename Traits::Coordinates
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
using gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::LogLevel = typename MatchBaseType::LogLevel
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
using gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::MatchBaseType = MatchBase<_PointType, _TransformVisitor, OptExts ..., CongruentSetExplorationOptions>
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
using gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::MatrixType = typename MatchBaseType::MatrixType
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
using gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::OptionsType = typename MatchBaseType::OptionsType
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
using gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::PairFilteringFunctor = _PairFilteringFunctor
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
using gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::PairsVector = std::vector< std::pair<int, int> >
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
using gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::PosMutablePoint = typename MatchBaseType::PosMutablePoint
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
using gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::RegistrationMetric = Utils::LCPMetric<Scalar>
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
using gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::Scalar = typename MatchBaseType::Scalar
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
using gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::Set = typename Traits::Set
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
using gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::Traits = _Traits
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
using gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::TransformVisitor = _TransformVisitor
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
using gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::VectorType = typename MatchBaseType::VectorType

Constructor & Destructor Documentation

template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
gr::CongruentSetExplorationBase< Traits, PointType, TransformVisitor, PairFilteringFunctor, OptExts >::CongruentSetExplorationBase ( const OptionsType options,
const Utils::Logger logger 
)

+ Here is the call graph for this function:

template<typename Traits , typename PointType , typename TransformVisitor , typename PairFilteringFunctor , template< class, class > class... OptExts>
gr::CongruentSetExplorationBase< Traits, PointType, TransformVisitor, PairFilteringFunctor, OptExts >::~CongruentSetExplorationBase ( )
virtual

Member Function Documentation

template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
const CongruentBaseType& gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::base3D ( ) const
inlineprotected
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
template<typename InputRange1 , typename InputRange2 , template< typename > class Sampler>
CongruentSetExplorationBase<Traits, PointType, TransformVisitor, PairFilteringFunctor, OptExts ...>::Scalar gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::ComputeTransformation ( const InputRange1 &  P,
const InputRange2 &  Q,
Eigen::Ref< typename CongruentSetExplorationBase< Traits, PointType, TransformVisitor, PairFilteringFunctor, OptExts... >::MatrixType transformation,
const Sampler< PointType > &  sampler,
TransformVisitor v 
)

+ Here is the call graph for this function:

template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
template<typename InputRange1 , typename InputRange2 , template< typename > class Sampler>
Scalar gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::ComputeTransformation ( const InputRange1 &  P,
const InputRange2 &  Q,
Eigen::Ref< MatrixType transformation,
const Sampler< _PointType > &  sampler,
TransformVisitor v 
)

Computes an approximation of the best LCP (directional) from Q to P and the rigid transformation that realizes it. The input sets may or may not contain normal information for any point.

Parameters
[in]PThe first input set.
[in]QThe second input set.
[out]transformationRigid transformation matrix (4x4) that brings Q to the (approximate) optimal LCP. Initial value is considered as a guess
Returns
the computed LCP measure as a fraction of the size of P ([0..1]).
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
virtual bool gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::generateCongruents ( CongruentBaseType base,
Set congruent_set 
)
protectedpure virtual

Find all the congruent set similar to the base in the second 3D model (Q). It could be with a 3 point base or a 4 point base.

Parameters
baseuse to find the similar points congruent in Q.
congruent_seta set of all point congruent found in Q.

Implemented in gr::Match3pcs< _PointType, _TransformVisitor, _PairFilteringFunctor, PairFilteringOptions >.

template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
virtual bool gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::initBase ( CongruentBaseType base)
pure virtual

Tries to compute an inital base from P.

Parameters
[out]baseThe base, if found. Initial value is not used. Modified as the computed base if the return value is true.
Returns
true if a base is found an initialized, false otherwise

Implemented in gr::Match3pcs< _PointType, _TransformVisitor, _PairFilteringFunctor, PairFilteringOptions >.

template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
bool gr::CongruentSetExplorationBase< Traits, PointType, TransformVisitor, PairFilteringFunctor, OptExts >::Perform_N_steps ( int  n,
Eigen::Ref< MatrixType transformation,
TransformVisitor v 
)
protected

Performs n RANSAC iterations, each one of them containing base selection, finding congruent sets and verification. Returns true if the process can be terminated (the target LCP was obtained or the maximum number of trials has been reached), false otherwise.

+ Here is the call graph for this function:

template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
bool gr::CongruentSetExplorationBase< Traits, PointType, TransformVisitor, PairFilteringFunctor, OptExts >::TryCongruentSet ( CongruentBaseType base,
Set set,
TransformVisitor v,
size_t &  nbCongruent 
)
protected

Loop over the set of congruent 4-points and test the compatibility with the input base.

Parameters
[out]NbNumber of quads corresponding to valid configurations

+ Here is the call graph for this function:

template<typename Traits , typename PointType , typename TransformVisitor , typename PairFilteringFunctor , template< class, class > class... OptExts>
bool gr::CongruentSetExplorationBase< Traits, PointType, TransformVisitor, PairFilteringFunctor, OptExts >::TryOneBase ( TransformVisitor v)
protected

Tries one base and finds the best transformation for this base. Returns true if the achieved LCP is greater than terminate_threshold_, else otherwise.

+ Here is the call graph for this function:

template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
CongruentSetExplorationBase< Traits, PointType, TransformVisitor, PairFilteringFunctor, OptExts... >::Scalar gr::CongruentSetExplorationBase< Traits, PointType, TransformVisitor, PairFilteringFunctor, OptExts >::Verify ( const Eigen::Ref< const MatrixType > &  mat) const
protected

For each randomly picked base, verifies the computed transformation by computing the number of points that this transformation brings near points in Q. Returns the current LCP. R is the rotation matrix, (tx,ty,tz) is the translation vector and (cx,cy,cz) is the center of transformation.template <class matrixderived>="">

+ Here is the call graph for this function:

Member Data Documentation

template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
CongruentBaseType gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::base_
protected

The points in the base (indices to P). It is being updated in every RANSAC iteration.

template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
Coordinates gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::base_3D_
protected

The 3D points of the base.

template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
Scalar gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::best_LCP_
protected

The best LCP (Largest Common Point) fraction so far.

template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
CongruentBaseType gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::current_congruent_
protected

The current congruent 4 points from Q. Every RANSAC iteration the algorithm examines a set of such congruent 4-points from Q and retains the best from them (the one that realizes the best LCP).

template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
int gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::current_trial_
protected

Current trial.

template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
constexpr Scalar gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::distance_factor = 2.0
static
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
constexpr Scalar gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::kLargeNumber = 1e9
static
template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
Scalar gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::max_base_diameter_ {Scalar( -1 )}
protected

Maximum base diameter. It is computed automatically from the diameter of P and the estimated overlap and used to limit the distance between the points in the base in P so that the probability to have all points in the base as inliers is increased.

template<typename _Traits, typename _PointType, typename _TransformVisitor, typename _PairFilteringFunctor, template< class, class > class... OptExts>
int gr::CongruentSetExplorationBase< _Traits, _PointType, _TransformVisitor, _PairFilteringFunctor, OptExts >::number_of_trials_
protected

Number of trials. Every trial picks random base from P.


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