Generic implementation for standard M-estimators. More...
#include <rrel_m_est_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_m_est_obj () | |
Constructor. | |
virtual | ~rrel_m_est_obj () |
Destructor. | |
virtual double | fcn (vect_const_iter res_begin, vect_const_iter res_end, vect_const_iter scale_begin, vnl_vector< double > *=0) const |
Evaluate the objective function on heteroscedastic residuals. | |
virtual double | fcn (vect_const_iter begin, vect_const_iter end, double scale, vnl_vector< double > *=0) const |
Evaluate the objective function on homoscedastic residuals. | |
virtual void | wgt (vect_const_iter res_begin, vect_const_iter res_end, vect_const_iter scale_begin, vect_iter wgt_begin) const |
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 |
Computes the weights for homoscedastic residuals. | |
virtual double | rho (double u) const =0 |
The robust loss function for the M-estimator. | |
double | rho (double r, double s) const |
The robust loss function for the M-estimator. | |
virtual double | wgt (double u) const =0 |
The weight of the residual. | |
double | wgt (double r, double s) const |
The weight of the residual. | |
virtual bool | requires_prior_scale () const |
False. | |
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. |
Generic implementation for standard M-estimators.
Most standard M-estimators are defined by a rho and psi functions on a normalised residual. This class allows derived classes to merely implement those two functions, and implements the fcn() and wgt() functions based on rho() and psi(). (See Stewart, "Robust Parameter Estimation in Computer Vision", SIAM Reviews 41, Sept 1999.)
Definition at line 19 of file rrel_m_est_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_m_est_obj::rrel_m_est_obj | ( | ) | [inline] |
Constructor.
Definition at line 22 of file rrel_m_est_obj.h.
virtual rrel_m_est_obj::~rrel_m_est_obj | ( | ) | [inline, virtual] |
Destructor.
Definition at line 25 of file rrel_m_est_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.
double rrel_m_est_obj::fcn | ( | vect_const_iter | res_begin, |
vect_const_iter | res_end, | ||
vect_const_iter | scale_begin, | ||
vnl_vector< double > * | = 0 |
||
) | const [virtual] |
Evaluate the objective function on heteroscedastic residuals.
Implements rrel_objective.
Definition at line 5 of file rrel_m_est_obj.cxx.
double rrel_m_est_obj::fcn | ( | vect_const_iter | begin, |
vect_const_iter | end, | ||
double | scale, | ||
vnl_vector< double > * | = 0 |
||
) | const [virtual] |
Evaluate the objective function on homoscedastic residuals.
Implements rrel_objective.
Definition at line 19 of file rrel_m_est_obj.cxx.
virtual bool rrel_m_est_obj::requires_prior_scale | ( | ) | const [inline, virtual] |
False.
In general, most M-estimators work quite well with an estimated scale. The scale estimate should be robust, but not necessarily efficient (e.g. MAD scale estimate.)
Implements rrel_objective.
Definition at line 73 of file rrel_m_est_obj.h.
virtual double rrel_m_est_obj::rho | ( | double | u | ) | const [pure virtual] |
The robust loss function for the M-estimator.
u is a normalised residual (i.e. u=r/scale).
Implemented in rrel_tukey_obj, rrel_trunc_quad_obj, and rrel_cauchy_obj.
double rrel_m_est_obj::rho | ( | double | r, |
double | s | ||
) | const [inline] |
The robust loss function for the M-estimator.
r is the residual and s is the scale for that residual.
Reimplemented in rrel_tukey_obj, rrel_trunc_quad_obj, and rrel_cauchy_obj.
Definition at line 58 of file rrel_m_est_obj.h.
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.
void rrel_m_est_obj::wgt | ( | vect_const_iter | res_begin, |
vect_const_iter | res_end, | ||
vect_const_iter | scale_begin, | ||
vect_iter | wgt_begin | ||
) | const [virtual] |
Evaluate the objective function on heteroscedastic residuals.
Implements rrel_wls_obj.
Reimplemented in rrel_tukey_obj, rrel_trunc_quad_obj, and rrel_cauchy_obj.
Definition at line 33 of file rrel_m_est_obj.cxx.
void rrel_m_est_obj::wgt | ( | vect_const_iter | begin, |
vect_const_iter | end, | ||
double | scale, | ||
vect_iter | wgt_begin | ||
) | const [virtual] |
Computes the weights for homoscedastic residuals.
Implements rrel_wls_obj.
Reimplemented in rrel_tukey_obj, rrel_trunc_quad_obj, and rrel_cauchy_obj.
Definition at line 43 of file rrel_m_est_obj.cxx.
virtual double rrel_m_est_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 .
Implements rrel_wls_obj.
Implemented in rrel_tukey_obj, rrel_trunc_quad_obj, and rrel_cauchy_obj.
double rrel_m_est_obj::wgt | ( | double | r, |
double | s | ||
) | const [inline] |
The weight of the residual.
r is the residual and s is the scale for that residual.
Reimplemented in rrel_tukey_obj, rrel_trunc_quad_obj, and rrel_cauchy_obj.
Definition at line 67 of file rrel_m_est_obj.h.