Read@CVL
rdf::LineFitting Class Reference

Implements robust line fitting algorithms. More...

#include <Algorithms.h>

Public Member Functions

 LineFitting (const QVector< Vector2D > &pts)
 
Line fitLineLMS () const
 Fits a line to the given set using the Least Median Squares method. In contrast to the official LMS, we extensively sample lines if the combinatorial effort is less than num sets. More...
 
Line fitLine () const
 

Protected Member Functions

void sample (const QVector< Vector2D > &pts, QVector< Vector2D > &set, int setSize=2) const
 Returns randomly sampled pts. More...
 
double medianResiduals (const QVector< Vector2D > &pts, const Line &line) const
 Returns the median of the squared distances between pts and the line. More...
 

Protected Attributes

int mNumSets = 1000
 
int mSetSize = 2
 
double mEps = 0.1
 
double mMinLength = 2
 
QVector< Vector2DmPts
 

Detailed Description

Implements robust line fitting algorithms.

Constructor & Destructor Documentation

rdf::LineFitting::LineFitting ( const QVector< Vector2D > &  pts)

Member Function Documentation

Line rdf::LineFitting::fitLine ( ) const
Line rdf::LineFitting::fitLineLMS ( ) const

Fits a line to the given set using the Least Median Squares method. In contrast to the official LMS, we extensively sample lines if the combinatorial effort is less than num sets.

Returns
The best fitting line.
double rdf::LineFitting::medianResiduals ( const QVector< Vector2D > &  pts,
const Line line 
) const
protected

Returns the median of the squared distances between pts and the line.

Parameters
ptsThe point set.
lineThe current fitting line.
Returns
The median squared distance.
void rdf::LineFitting::sample ( const QVector< Vector2D > &  pts,
QVector< Vector2D > &  set,
int  setSize = 2 
) const
protected

Returns randomly sampled pts.

Parameters
ptsInput points.
setA randomly sampled set of size setSize.
setSizeThe set size returned.

Member Data Documentation

double rdf::LineFitting::mEps = 0.1
protected
double rdf::LineFitting::mMinLength = 2
protected
int rdf::LineFitting::mNumSets = 1000
protected
QVector<Vector2D> rdf::LineFitting::mPts
protected
int rdf::LineFitting::mSetSize = 2
protected

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