Subclass of the generalized 8-DOF homography estimator for affine transformations (6 DOF). More...
#include <rrel_homography2d_est_aff.h>
Public Types | |
enum | scale_t { NONE = 0, SINGLE = 1, MULTIPLE = 2 } |
Type of scale information this problem provides. More... | |
Public Member Functions | |
rrel_homography2d_est_aff (const vcl_vector< vgl_homg_point_2d< double > > &from_pts, const vcl_vector< vgl_homg_point_2d< double > > &to_pts) | |
Constructor from vgl_homg_point_2d's. | |
rrel_homography2d_est_aff (const vcl_vector< vnl_vector< double > > &from_pts, const vcl_vector< vnl_vector< double > > &to_pts) | |
Constructor from vnl_vectors. | |
virtual | ~rrel_homography2d_est_aff () |
Destructor. | |
virtual void | homography_to_parameters (const vnl_matrix< double > &m, vnl_vector< double > &p) const |
Convert a homography to a linear parameter list (for estimation). | |
virtual void | parameters_to_homography (const vnl_vector< double > &p, vnl_matrix< double > &m) const |
Convert a linear parameter list (from estimation) to a homography. | |
unsigned int | num_samples () const |
Total number of correspondences. | |
unsigned int | residual_dof () const |
The degrees of freedom in the residual. | |
bool | fit_from_minimal_set (const vcl_vector< int > &point_indices, vnl_vector< double > ¶ms) const |
Generate a parameter estimate from a minimal sample. | |
void | compute_residuals (const vnl_vector< double > ¶ms, vcl_vector< double > &residuals) const |
Compute unsigned fit residuals relative to the parameter estimate. | |
bool | weighted_least_squares_fit (vnl_vector< double > ¶ms, vnl_matrix< double > &norm_covar, const vcl_vector< double > *weights=0) const |
Weighted least squares parameter estimate. The normalized covariance is not yet filled in. | |
virtual void | homog_to_params (const vnl_matrix< double > &m, vnl_vector< double > &p) const |
Convert a homography to a linear parameter list (for estimation). | |
virtual void | params_to_homog (const vnl_vector< double > &p, vnl_matrix< double > &m) const |
Convert a linear parameter list (from estimation) to a homography. | |
void | print_points () const |
Print information as a test utility. | |
unsigned int | param_dof () const |
The degrees of freedom in the parameter set. | |
unsigned int | num_samples_to_instantiate () const |
Minimum number of samples required to uniquely instantiate a fit. | |
virtual unsigned int | num_unique_samples () const |
The number of "unique" samples. | |
virtual void | compute_weights (const vcl_vector< double > &residuals, const rrel_wls_obj *obj, double scale, vcl_vector< double > &weights) const |
Compute the weights for the given residuals. | |
virtual scale_t | scale_type () const |
Type of scale information the problem provides. | |
virtual const vcl_vector < double > & | prior_multiple_scales () const |
The prior scale vector, if available. | |
virtual double | prior_scale () const |
The prior scale, if available. | |
virtual void | set_prior_multiple_scales (const vcl_vector< double > &scales) |
Sets the scales for heteroscedastic data. | |
virtual void | set_prior_scale (double scale) |
Sets the scale for homoscedastic data. | |
virtual void | set_no_prior_scale () |
Removes the scale information for the problem. | |
void | set_similarity_weights (const vcl_vector< double > &wgts) |
Set similarity weights. | |
const vcl_vector< double > & | similarity_weights () const |
Get similarity weights. | |
Protected Member Functions | |
void | normalize (const vcl_vector< vnl_vector< double > > &pts, const vcl_vector< double > &wgts, vcl_vector< vnl_vector< double > > &norm_pts, vnl_matrix< double > &norm_matrix) const |
void | set_param_dof (unsigned int dof) |
Set the degrees of freedom. | |
void | set_num_samples_for_fit (unsigned int num_samp) |
Set the number of samples needed for a unique fit. | |
void | set_scale_type (scale_t t) |
Set the type of prior scale. | |
Protected Attributes | |
vcl_vector< vnl_vector< double > > | from_pts_ |
vcl_vector< vnl_vector< double > > | to_pts_ |
unsigned int | homog_dof_ |
unsigned int | min_num_pts_ |
Subclass of the generalized 8-DOF homography estimator for affine transformations (6 DOF).
Definition at line 11 of file rrel_homography2d_est_aff.h.
enum rrel_estimation_problem::scale_t [inherited] |
Type of scale information this problem provides.
NONE: problem does not provide any scale information. SINGLE: problem provides a single prior scale (homoscedastic data). MULTIPLE: problem provides a scale for each residual (heteroscedastic data).
Definition at line 40 of file rrel_estimation_problem.h.
rrel_homography2d_est_aff::rrel_homography2d_est_aff | ( | const vcl_vector< vgl_homg_point_2d< double > > & | from_pts, |
const vcl_vector< vgl_homg_point_2d< double > > & | to_pts | ||
) |
Constructor from vgl_homg_point_2d's.
Definition at line 10 of file rrel_homography2d_est_aff.cxx.
rrel_homography2d_est_aff::rrel_homography2d_est_aff | ( | const vcl_vector< vnl_vector< double > > & | from_pts, |
const vcl_vector< vnl_vector< double > > & | to_pts | ||
) |
Constructor from vnl_vectors.
Definition at line 17 of file rrel_homography2d_est_aff.cxx.
rrel_homography2d_est_aff::~rrel_homography2d_est_aff | ( | ) | [virtual] |
Destructor.
Definition at line 24 of file rrel_homography2d_est_aff.cxx.
void rrel_homography2d_est::compute_residuals | ( | const vnl_vector< double > & | params, |
vcl_vector< double > & | residuals | ||
) | const [virtual, inherited] |
Compute unsigned fit residuals relative to the parameter estimate.
Implements rrel_estimation_problem.
Definition at line 102 of file rrel_homography2d_est.cxx.
void rrel_estimation_problem::compute_weights | ( | const vcl_vector< double > & | residuals, |
const rrel_wls_obj * | obj, | ||
double | scale, | ||
vcl_vector< double > & | weights | ||
) | const [virtual, inherited] |
Compute the weights for the given residuals.
The residuals are essentially those returned by compute_residuals(). The default behaviour is to apply obj->wgt() to each residual. Some problems, however, many need to augment the weights. Such problems should override this function (but may want to call this to compute the "basic" weights).
Definition at line 33 of file rrel_estimation_problem.cxx.
bool rrel_homography2d_est::fit_from_minimal_set | ( | const vcl_vector< int > & | point_indices, |
vnl_vector< double > & | params | ||
) | const [virtual, inherited] |
Generate a parameter estimate from a minimal sample.
Implements rrel_estimation_problem.
Definition at line 70 of file rrel_homography2d_est.cxx.
void rrel_homography2d_est::homog_to_params | ( | const vnl_matrix< double > & | m, |
vnl_vector< double > & | p | ||
) | const [virtual, inherited] |
Convert a homography to a linear parameter list (for estimation).
Overloaded for specialized reduced-DOF homographies (i.e. affine)
Definition at line 203 of file rrel_homography2d_est.cxx.
void rrel_homography2d_est_aff::homography_to_parameters | ( | const vnl_matrix< double > & | m, |
vnl_vector< double > & | p | ||
) | const [virtual] |
Convert a homography to a linear parameter list (for estimation).
Definition at line 30 of file rrel_homography2d_est_aff.cxx.
void rrel_homography2d_est::normalize | ( | const vcl_vector< vnl_vector< double > > & | pts, |
const vcl_vector< double > & | wgts, | ||
vcl_vector< vnl_vector< double > > & | norm_pts, | ||
vnl_matrix< double > & | norm_matrix | ||
) | const [protected, inherited] |
Definition at line 221 of file rrel_homography2d_est.cxx.
unsigned int rrel_homography2d_est::num_samples | ( | ) | const [virtual, inherited] |
Total number of correspondences.
Implements rrel_estimation_problem.
Definition at line 63 of file rrel_homography2d_est.cxx.
unsigned int rrel_estimation_problem::num_samples_to_instantiate | ( | ) | const [inline, inherited] |
Minimum number of samples required to uniquely instantiate a fit.
dof()/num_samples_to_instantiate() gives the number of constraints per sample.
Definition at line 61 of file rrel_estimation_problem.h.
virtual unsigned int rrel_estimation_problem::num_unique_samples | ( | ) | const [inline, virtual, inherited] |
The number of "unique" samples.
In most problems, this equals num_samples. With estimation problems involving non-unique correspondences, however, the total number of possible correspondences (= num_samples()) generally much greater than the number of "unique samples" (which would be the number of points from one image).
This is used by random sampling techniques to determine the number of samples required to get a given probability of success.
Definition at line 84 of file rrel_estimation_problem.h.
unsigned int rrel_estimation_problem::param_dof | ( | ) | const [inline, inherited] |
The degrees of freedom in the parameter set.
Definition at line 57 of file rrel_estimation_problem.h.
void rrel_homography2d_est_aff::parameters_to_homography | ( | const vnl_vector< double > & | p, |
vnl_matrix< double > & | m | ||
) | const [virtual] |
Convert a linear parameter list (from estimation) to a homography.
Definition at line 45 of file rrel_homography2d_est_aff.cxx.
void rrel_homography2d_est::params_to_homog | ( | const vnl_vector< double > & | p, |
vnl_matrix< double > & | m | ||
) | const [virtual, inherited] |
Convert a linear parameter list (from estimation) to a homography.
Overloaded for specialized reduced-DOF homographies (i.e. affine)
Definition at line 212 of file rrel_homography2d_est.cxx.
void rrel_homography2d_est::print_points | ( | ) | const [inherited] |
Print information as a test utility.
Definition at line 260 of file rrel_homography2d_est.cxx.
const vcl_vector< double > & rrel_estimation_problem::prior_multiple_scales | ( | ) | const [virtual, inherited] |
The prior scale vector, if available.
The call is valid only if scale_type() == MULTIPLE.
Definition at line 59 of file rrel_estimation_problem.cxx.
double rrel_estimation_problem::prior_scale | ( | ) | const [virtual, inherited] |
The prior scale, if available.
The call is valid only if scale_type() == SINGLE.
Definition at line 66 of file rrel_estimation_problem.cxx.
unsigned int rrel_homography2d_est::residual_dof | ( | ) | const [inline, virtual, inherited] |
The degrees of freedom in the residual.
Each coordinate of the correspondence pair has Gaussian error, so the Euclidean distance residual has 4 degrees of freedom.
Reimplemented from rrel_estimation_problem.
Definition at line 63 of file rrel_homography2d_est.h.
virtual scale_t rrel_estimation_problem::scale_type | ( | ) | const [inline, virtual, inherited] |
Type of scale information the problem provides.
Definition at line 116 of file rrel_estimation_problem.h.
void rrel_estimation_problem::set_no_prior_scale | ( | ) | [virtual, inherited] |
Removes the scale information for the problem.
Side effect: set scale_type() = NONE.
Definition at line 90 of file rrel_estimation_problem.cxx.
void rrel_estimation_problem::set_num_samples_for_fit | ( | unsigned int | num_samp | ) | [inline, protected, inherited] |
Set the number of samples needed for a unique fit.
Definition at line 167 of file rrel_estimation_problem.h.
void rrel_estimation_problem::set_param_dof | ( | unsigned int | dof | ) | [inline, protected, inherited] |
Set the degrees of freedom.
Definition at line 164 of file rrel_estimation_problem.h.
void rrel_estimation_problem::set_prior_multiple_scales | ( | const vcl_vector< double > & | scales | ) | [virtual, inherited] |
Sets the scales for heteroscedastic data.
Side effect: set scale_type() = MULTIPLE.
Definition at line 73 of file rrel_estimation_problem.cxx.
void rrel_estimation_problem::set_prior_scale | ( | double | scale | ) | [virtual, inherited] |
Sets the scale for homoscedastic data.
Side effect: set scale_type() = SINGLE.
Definition at line 83 of file rrel_estimation_problem.cxx.
void rrel_estimation_problem::set_scale_type | ( | scale_t | t | ) | [inline, protected, inherited] |
Set the type of prior scale.
Definition at line 170 of file rrel_estimation_problem.h.
void rrel_estimation_problem::set_similarity_weights | ( | const vcl_vector< double > & | wgts | ) | [inline, inherited] |
Set similarity weights.
Currently it is only used in wgted random sampling search
Definition at line 140 of file rrel_estimation_problem.h.
const vcl_vector<double>& rrel_estimation_problem::similarity_weights | ( | ) | const [inline, inherited] |
Get similarity weights.
Definition at line 144 of file rrel_estimation_problem.h.
bool rrel_homography2d_est::weighted_least_squares_fit | ( | vnl_vector< double > & | params, |
vnl_matrix< double > & | norm_covar, | ||
const vcl_vector< double > * | weights = 0 |
||
) | const [virtual, inherited] |
Weighted least squares parameter estimate. The normalized covariance is not yet filled in.
Implements rrel_estimation_problem.
Definition at line 144 of file rrel_homography2d_est.cxx.
vcl_vector< vnl_vector<double> > rrel_homography2d_est::from_pts_ [protected, inherited] |
Definition at line 99 of file rrel_homography2d_est.h.
unsigned int rrel_homography2d_est::homog_dof_ [protected, inherited] |
Definition at line 101 of file rrel_homography2d_est.h.
unsigned int rrel_homography2d_est::min_num_pts_ [protected, inherited] |
Definition at line 102 of file rrel_homography2d_est.h.
vcl_vector< vnl_vector<double> > rrel_homography2d_est::to_pts_ [protected, inherited] |
Definition at line 100 of file rrel_homography2d_est.h.