The Least-Median-of-Squares (LMS) objective function. More...
#include <rrel_lms_obj.h>
Public Types | |
typedef vcl_vector< double > ::const_iterator | vect_const_iter |
The iterators used to pass in values. | |
typedef vcl_vector< double > ::iterator | vect_iter |
The iterators used to pass out values. | |
Public Member Functions | |
rrel_lms_obj (unsigned int num_sam_inst, double inlier_frac=0.5) | |
Constructor. | |
~rrel_lms_obj () | |
virtual double | fcn (vect_const_iter res_begin, vect_const_iter res_end, vect_const_iter, vnl_vector< double > *=0) const |
Evaluate the objective function on heteroscedastic residuals. | |
virtual double | fcn (vect_const_iter begin, vect_const_iter end, double=0, vnl_vector< double > *=0) const |
Evaluate the objective function on homoscedastic residuals. | |
virtual bool | requires_prior_scale () const |
False. | |
virtual bool | can_estimate_scale () const |
True. The scale is estimated as MAD (Median Absolute Deviation). | |
virtual double | scale (vect_const_iter res_begin, vect_const_iter res_end) const |
Scale estimate (median absolute deviation -- MAD). | |
Protected Attributes | |
unsigned int | num_sam_inst_ |
Number of samples needed for a unique fit = number of dependent residuals. | |
double | inlier_frac_ |
The Least-Median-of-Squares (LMS) objective function.
The Least-Median-of-Squares algorithm was defined in a 1984 Journal of the American Statistical Association paper by Peter Rousseeuw (vol 79, pp 871-880). (See Stewart, "Robust Parameter Estimation in Computer Vision", SIAM Reviews 41, Sept 1999.) The class implemented here gives the objective function for that algorithm. The LMS objective function is the median of the squared residuals. This class is generalised to allow any inlier fraction (not just the median) from the order statistics.
Definition at line 25 of file rrel_lms_obj.h.
typedef vcl_vector<double>::const_iterator rrel_objective::vect_const_iter [inherited] |
The iterators used to pass in values.
Since we don't allow member templates, we have to fix on a particular type of container for residuals. Using this typedef will allow things to easily change when member templates are allowed.
Definition at line 27 of file rrel_objective.h.
typedef vcl_vector<double>::iterator rrel_objective::vect_iter [inherited] |
The iterators used to pass out values.
Definition at line 30 of file rrel_objective.h.
rrel_lms_obj::rrel_lms_obj | ( | unsigned int | num_sam_inst, |
double | inlier_frac = 0.5 |
||
) |
Constructor.
num_sam_inst is the minimum number of samples needed for a unique parameter estimate. That is, num_sam_inst should be set to rrel_estimation_problem::num_samples_to_instantiate(). inlier_frac is the minimum expected number of inlier residuals. The default value of 0.5 makes this the standard median objective function. In general, it should be 1 minus the maximum expected fraction of outliers. If the maximum expected fraction of outliers is not known, then the MUSE objective function should be used.
Definition at line 12 of file rrel_lms_obj.cxx.
rrel_lms_obj::~rrel_lms_obj | ( | ) |
Definition at line 18 of file rrel_lms_obj.cxx.
virtual bool rrel_lms_obj::can_estimate_scale | ( | ) | const [inline, virtual] |
True. The scale is estimated as MAD (Median Absolute Deviation).
Reimplemented from rrel_objective.
Definition at line 62 of file rrel_lms_obj.h.
double rrel_lms_obj::fcn | ( | vect_const_iter | res_begin, |
vect_const_iter | res_end, | ||
vect_const_iter | , | ||
vnl_vector< double > * | = 0 |
||
) | const [virtual] |
Evaluate the objective function on heteroscedastic residuals.
Implements rrel_objective.
Definition at line 24 of file rrel_lms_obj.cxx.
double rrel_lms_obj::fcn | ( | vect_const_iter | begin, |
vect_const_iter | end, | ||
double | = 0 , |
||
vnl_vector< double > * | = 0 |
||
) | const [virtual] |
Evaluate the objective function on homoscedastic residuals.
Implements rrel_objective.
Definition at line 33 of file rrel_lms_obj.cxx.
virtual bool rrel_lms_obj::requires_prior_scale | ( | ) | const [inline, virtual] |
False.
The LMS objective is based on order statistics, and does not require any scale parameter, estimated or otherwise.
Implements rrel_objective.
Definition at line 57 of file rrel_lms_obj.h.
double rrel_lms_obj::scale | ( | vect_const_iter | res_begin, |
vect_const_iter | res_end | ||
) | const [virtual] |
Scale estimate (median absolute deviation -- MAD).
Reimplemented from rrel_objective.
Definition at line 72 of file rrel_lms_obj.cxx.
double rrel_lms_obj::inlier_frac_ [protected] |
Definition at line 71 of file rrel_lms_obj.h.
unsigned int rrel_lms_obj::num_sam_inst_ [protected] |
Number of samples needed for a unique fit = number of dependent residuals.
Definition at line 70 of file rrel_lms_obj.h.