Main MRPT website > C++ reference for MRPT 1.9.9
List of all members | Public Types | Public Member Functions
mrpt::math::RANSAC_Template< NUMTYPE > Class Template Reference

Detailed Description

template<typename NUMTYPE = double>
class mrpt::math::RANSAC_Template< NUMTYPE >

A generic RANSAC implementation with models as matrices.

See RANSAC_Template::execute for more info on usage.

See also
mrpt::math::ModelSearch, a more versatile RANSAC implementation where models can be anything else, not only matrices.

Definition at line 31 of file ransac.h.

#include <mrpt/math/ransac.h>

Inheritance diagram for mrpt::math::RANSAC_Template< NUMTYPE >:
Inheritance graph

Public Types

using TRansacFitFunctor = std::function< void(const CMatrixTemplateNumeric< NUMTYPE > &allData, const mrpt::vector_size_t &useIndices, std::vector< CMatrixTemplateNumeric< NUMTYPE > > &fitModels)>
 The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. More...
 
using TRansacDistanceFunctor = std::function< void(const CMatrixTemplateNumeric< NUMTYPE > &allData, const std::vector< CMatrixTemplateNumeric< NUMTYPE > > &testModels, const NUMTYPE distanceThreshold, unsigned int &out_bestModelIndex, mrpt::vector_size_t &out_inlierIndices)>
 The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. More...
 
using TRansacDegenerateFunctor = std::function< bool(const CMatrixTemplateNumeric< NUMTYPE > &allData, const mrpt::vector_size_t &useIndices)>
 The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info. More...
 

Public Member Functions

 RANSAC_Template ()
 
bool execute (const CMatrixTemplateNumeric< NUMTYPE > &data, const TRansacFitFunctor &fit_func, const TRansacDistanceFunctor &dist_func, const TRansacDegenerateFunctor &degen_func, const double distanceThreshold, const unsigned int minimumSizeSamplesToFit, mrpt::vector_size_t &out_best_inliers, CMatrixTemplateNumeric< NUMTYPE > &out_best_model, const double prob_good_sample=0.999, const size_t maxIter=2000) const
 An implementation of the RANSAC algorithm for robust fitting of models to data. More...
 

Member Typedef Documentation

◆ TRansacDegenerateFunctor

template<typename NUMTYPE = double>
using mrpt::math::RANSAC_Template< NUMTYPE >::TRansacDegenerateFunctor = std::function<bool( const CMatrixTemplateNumeric<NUMTYPE>& allData, const mrpt::vector_size_t& useIndices)>

The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info.

Definition at line 54 of file ransac.h.

◆ TRansacDistanceFunctor

template<typename NUMTYPE = double>
using mrpt::math::RANSAC_Template< NUMTYPE >::TRansacDistanceFunctor = std::function<void( const CMatrixTemplateNumeric<NUMTYPE>& allData, const std::vector<CMatrixTemplateNumeric<NUMTYPE> >& testModels, const NUMTYPE distanceThreshold, unsigned int& out_bestModelIndex, mrpt::vector_size_t& out_inlierIndices)>

The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info.

Definition at line 48 of file ransac.h.

◆ TRansacFitFunctor

template<typename NUMTYPE = double>
using mrpt::math::RANSAC_Template< NUMTYPE >::TRansacFitFunctor = std::function<void( const CMatrixTemplateNumeric<NUMTYPE>& allData, const mrpt::vector_size_t& useIndices, std::vector<CMatrixTemplateNumeric<NUMTYPE> >& fitModels)>

The type of the function passed to mrpt::math::ransac - See the documentation for that method for more info.

Definition at line 40 of file ransac.h.

Constructor & Destructor Documentation

◆ RANSAC_Template()

template<typename NUMTYPE = double>
mrpt::math::RANSAC_Template< NUMTYPE >::RANSAC_Template ( )
inline

Definition at line 34 of file ransac.h.

Member Function Documentation

◆ execute()

template<typename NUMTYPE >
bool RANSAC_Template::execute ( const CMatrixTemplateNumeric< NUMTYPE > &  data,
const TRansacFitFunctor fit_func,
const TRansacDistanceFunctor dist_func,
const TRansacDegenerateFunctor degen_func,
const double  distanceThreshold,
const unsigned int  minimumSizeSamplesToFit,
mrpt::vector_size_t out_best_inliers,
CMatrixTemplateNumeric< NUMTYPE > &  out_best_model,
const double  prob_good_sample = 0.999,
const size_t  maxIter = 2000 
) const

An implementation of the RANSAC algorithm for robust fitting of models to data.

Parameters
dataA DxN matrix with all the observed data. D is the dimensionality of data points and N the number of points.
Thisimplementation is highly inspired on Peter Kovesi's MATLAB scripts (http://www.csse.uwa.edu.au/~pk).
Returns
false if no good solution can be found, true on success.
Note
[MRPT 1.5.0] verbose parameter has been removed, supersedded by COutputLogger settings.

Definition at line 25 of file ransac.cpp.

References ASSERT_, mrpt::random::CRandomGenerator::drawUniformVector(), mrpt::format(), mrpt::random::getRandomGenerator(), min, MRPT_END, MRPT_LOG_DEBUG, MRPT_LOG_INFO, MRPT_LOG_WARN, and MRPT_START.

Referenced by mrpt::pbmap::ConsistencyTest::estimatePoseRANSAC(), and mrpt::math::ransac_detect_2D_lines().

Here is the call graph for this function:
Here is the caller graph for this function:



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019