OpenMS
Loading...
Searching...
No Matches
RansacModel< ModelT > Class Template Reference

Generic plug-in template base class using 'Curiously recurring template pattern' (CRTP) to allow for arbitrary RANSAC models (e.g. linear or quadratic fits). More...

#include <OpenMS/ML/RANSAC/RANSACModel.h>

Inheritance diagram for RansacModel< ModelT >:
[legend]

Public Types

typedef std::pair< double, double > DPair
 
typedef std::vector< DPairDVec
 
typedef DVec::const_iterator DVecIt
 
typedef std::vector< double > ModelParameters
 

Public Member Functions

ModelParameters rm_fit (const DVecIt &begin, const DVecIt &end) const
 fit a model and return its parameters
 
double rm_rsq (const DVecIt &begin, const DVecIt &end) const
 Returns the R-squared of the data applied to the model (computed on-the-fly).
 
double rm_rss (const DVecIt &begin, const DVecIt &end, const ModelParameters &coefficients) const
 calculates the residual sum of squares of the input points according to the model
 
DVec rm_inliers (const DVecIt &begin, const DVecIt &end, const ModelParameters &coefficients, double max_threshold) const
 

Detailed Description

template<class ModelT = int>
class OpenMS::Math::RansacModel< ModelT >

Generic plug-in template base class using 'Curiously recurring template pattern' (CRTP) to allow for arbitrary RANSAC models (e.g. linear or quadratic fits).

An actual model should derive from this class using CRTP (see RansacModelLinear for an example) and implement the *_impl() functions.

Member Typedef Documentation

◆ DPair

template<class ModelT = int>
typedef std::pair<double, double> DPair

◆ DVec

template<class ModelT = int>
typedef std::vector<DPair> DVec

◆ DVecIt

template<class ModelT = int>
typedef DVec::const_iterator DVecIt

◆ ModelParameters

template<class ModelT = int>
typedef std::vector<double> ModelParameters

Member Function Documentation

◆ rm_fit()

template<class ModelT = int>
ModelParameters rm_fit ( const DVecIt begin,
const DVecIt end 
) const
inline

fit a model and return its parameters

◆ rm_inliers()

template<class ModelT = int>
DVec rm_inliers ( const DVecIt begin,
const DVecIt end,
const ModelParameters coefficients,
double  max_threshold 
) const
inline

calculates the squared residual of each input point vs. the model. All points with an error <= max_threshold, are accepted as inliers and returned.

◆ rm_rsq()

template<class ModelT = int>
double rm_rsq ( const DVecIt begin,
const DVecIt end 
) const
inline

Returns the R-squared of the data applied to the model (computed on-the-fly).

Takes as input a standard vector of a standard pair of points in a 2D space.

Parameters
[in]beginIterator to first pair
[in]endPast-end iterator to last pair
Returns
: R-squared value

◆ rm_rss()

template<class ModelT = int>
double rm_rss ( const DVecIt begin,
const DVecIt end,
const ModelParameters coefficients 
) const
inline

calculates the residual sum of squares of the input points according to the model