Abstract base class for objective functions that can compute weights. More...
#include <rrel_wls_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_wls_obj () | |
Constructor. | |
virtual | ~rrel_wls_obj () |
Destructor. | |
virtual void | wgt (vect_const_iter res_begin, vect_const_iter res_end, vect_const_iter scale_begin, vect_iter wgt_begin) const =0 |
Evaluate the objective function on heteroscedastic residuals. | |
virtual void | wgt (vect_const_iter begin, vect_const_iter end, double scale, vect_iter wgt_begin) const =0 |
Computes the weights for homoscedastic residuals. | |
virtual double | wgt (double u) const =0 |
The weight of the residual. | |
virtual double | fcn (vect_const_iter res_begin, vect_const_iter res_end, vect_const_iter scale_begin, vnl_vector< double > *param_vector) const =0 |
Evaluate the objective function on heteroscedastic residuals. | |
virtual double | fcn (vect_const_iter begin, vect_const_iter end, double scale, vnl_vector< double > *param_vector) const =0 |
Evaluate the objective function on homoscedastic residuals. | |
virtual bool | requires_prior_scale () const =0 |
True if the objective function must have a prior scale. | |
virtual bool | can_estimate_scale () const |
True if the objective function can estimate scale. | |
virtual double | scale (vect_const_iter, vect_const_iter) const |
Scale estimate. |
Abstract base class for objective functions that can compute weights.
This class of objective functions, in addition to providing a "cost" for the estimate, can provide a weight for each residual. The weights are used by some search techniques, such as IRLS. Most commonly used M-estimator objective functions can provide a weights, and hence will be a descendant of this class. (See Stewart, "Robust Parameter Estimation in Computer Vision", SIAM Reviews 41, Sept 1999.)
Definition at line 21 of file rrel_wls_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_wls_obj::rrel_wls_obj | ( | ) | [inline] |
Constructor.
Definition at line 24 of file rrel_wls_obj.h.
virtual rrel_wls_obj::~rrel_wls_obj | ( | ) | [inline, virtual] |
Destructor.
Definition at line 27 of file rrel_wls_obj.h.
virtual bool rrel_objective::can_estimate_scale | ( | ) | const [inline, virtual, inherited] |
True if the objective function can estimate scale.
Some objective functions, such as MUSE, can provide an accurate inlier scale estimate.
Reimplemented in rrel_muset_obj, and rrel_lms_obj.
Definition at line 72 of file rrel_objective.h.
virtual double rrel_objective::fcn | ( | vect_const_iter | res_begin, |
vect_const_iter | res_end, | ||
vect_const_iter | scale_begin, | ||
vnl_vector< double > * | param_vector | ||
) | const [pure virtual, inherited] |
Evaluate the objective function on heteroscedastic residuals.
This version is used for heteroscedastic data, where each residual has its own scale. Some objective functions, such as M-estimators, will require a scale value. Others, such as Least Median of Squares (LMS) with intercept adjustment, will require access to the parameter vector.
The number of scale values must, of course, equal the number of residuals.
Implemented in rrel_muset_obj, rrel_mlesac_obj, rrel_lms_obj, rrel_lts_obj, rrel_kernel_density_obj, rrel_ransac_obj, and rrel_m_est_obj.
virtual double rrel_objective::fcn | ( | vect_const_iter | begin, |
vect_const_iter | end, | ||
double | scale, | ||
vnl_vector< double > * | param_vector | ||
) | const [pure virtual, inherited] |
Evaluate the objective function on homoscedastic residuals.
This version is used for homoscedastic data, where each residual is distributed with a common scale. Some objective functions, such as M-estimators, will require a scale value. Others, such as Least Median of Squares (LMS) with intercept adjustment, will require access to the parameter vector.
Using the previous function for homoscedastic data would imply the creation of a vector of equal values. Since the majority of problems assume homoscedastic data, a "convenience" function that avoids the scale vector is useful.
Implemented in rrel_muset_obj, rrel_mlesac_obj, rrel_lms_obj, rrel_kernel_density_obj, rrel_lts_obj, rrel_ransac_obj, and rrel_m_est_obj.
virtual bool rrel_objective::requires_prior_scale | ( | ) | const [pure virtual, inherited] |
True if the objective function must have a prior scale.
For some objective functions, such as RANSAC, an estimated scale is not enough. The problem must have a prior scale estimate.
Implemented in rrel_muset_obj, rrel_m_est_obj, rrel_mlesac_obj, rrel_kernel_density_obj, rrel_lms_obj, rrel_lts_obj, and rrel_ransac_obj.
virtual double rrel_objective::scale | ( | vect_const_iter | , |
vect_const_iter | |||
) | const [inline, virtual, inherited] |
Scale estimate.
The result is undefined if can_estimate_scale() is false.
Reimplemented in rrel_muset_obj, and rrel_lms_obj.
Definition at line 76 of file rrel_objective.h.
virtual void rrel_wls_obj::wgt | ( | vect_const_iter | res_begin, |
vect_const_iter | res_end, | ||
vect_const_iter | scale_begin, | ||
vect_iter | wgt_begin | ||
) | const [pure virtual] |
Evaluate the objective function on heteroscedastic residuals.
This version is used for heteroscedastic data, where each residual has its own scale. The number of scale values must, of course, equal the number of residuals.
The weights (one per residual) are returned using wgt_begin, which should point to an appropriately sized container.
Implemented in rrel_tukey_obj, rrel_trunc_quad_obj, rrel_cauchy_obj, and rrel_m_est_obj.
virtual void rrel_wls_obj::wgt | ( | vect_const_iter | begin, |
vect_const_iter | end, | ||
double | scale, | ||
vect_iter | wgt_begin | ||
) | const [pure virtual] |
Computes the weights for homoscedastic residuals.
This version is used for homoscedastic data, where each residual is distributed with a common scale. (See also the comments in rrel_objective::fcn.)
The weights (one per residual) are returned using wgt_begin, which should point to an appropriately sized container.
Implemented in rrel_tukey_obj, rrel_trunc_quad_obj, rrel_cauchy_obj, and rrel_m_est_obj.
virtual double rrel_wls_obj::wgt | ( | double | u | ) | const [pure virtual] |
The weight of the residual.
u is a normalised residual (i.e. u=r/scale). wgt(u) is normally .
Implemented in rrel_m_est_obj, rrel_tukey_obj, rrel_trunc_quad_obj, and rrel_cauchy_obj.