Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
vgl_h_matrix_2d_compute_linear Class Reference

#include <vgl_h_matrix_2d_compute_linear.h>

Inheritance diagram for vgl_h_matrix_2d_compute_linear:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 vgl_h_matrix_2d_compute_linear (bool allow_ideal_points=false)
 Construct a vgl_h_matrix_2d_compute_linear object.
int minimum_number_of_correspondences () const
void verbose (bool v)
bool compute (vcl_vector< vgl_homg_point_2d< double > > const &points1, vcl_vector< vgl_homg_point_2d< double > > const &points2, vgl_h_matrix_2d< double > &H)
 homography from matched points.
bool compute (vcl_vector< vgl_homg_line_2d< double > > const &lines1, vcl_vector< vgl_homg_line_2d< double > > const &lines2, vgl_h_matrix_2d< double > &H)
 homography from matched lines.
bool compute (vcl_vector< vgl_homg_line_2d< double > > const &lines1, vcl_vector< vgl_homg_line_2d< double > > const &lines2, vcl_vector< double > const &weights, vgl_h_matrix_2d< double > &H)
 homography from matched lines with a weight vector.
bool compute (vcl_vector< vgl_homg_point_2d< double > > const &points1, vcl_vector< vgl_homg_point_2d< double > > const &points2, vcl_vector< vgl_homg_line_2d< double > > const &lines1, vcl_vector< vgl_homg_line_2d< double > > const &lines2, vgl_h_matrix_2d< double > &H)
 homography from matched points and lines.
vgl_h_matrix_2d< double > compute (vcl_vector< vgl_homg_point_2d< double > > const &p1, vcl_vector< vgl_homg_point_2d< double > > const &p2)
 homography from matched points - return h_matrix.
vgl_h_matrix_2d< double > compute (vcl_vector< vgl_homg_line_2d< double > > const &l1, vcl_vector< vgl_homg_line_2d< double > > const &l2)
 homography from matched lines - return h_matrix.
vgl_h_matrix_2d< double > compute (vcl_vector< vgl_homg_line_2d< double > > const &l1, vcl_vector< vgl_homg_line_2d< double > > const &l2, vcl_vector< double > const &weights)
 homography from matched lines with weight vector - return h_matrix.
vgl_h_matrix_2d< double > compute (vcl_vector< vgl_homg_point_2d< double > > const &p1, vcl_vector< vgl_homg_point_2d< double > > const &p2, vcl_vector< vgl_homg_line_2d< double > > const &l1, vcl_vector< vgl_homg_line_2d< double > > const &l2)
 homography from matched points and lines - return h_matrix.

Protected Member Functions

virtual bool compute_p (vcl_vector< vgl_homg_point_2d< double > > const &points1, vcl_vector< vgl_homg_point_2d< double > > const &points2, vgl_h_matrix_2d< double > &H)
 compute from matched points.
virtual bool compute_l (vcl_vector< vgl_homg_line_2d< double > > const &lines1, vcl_vector< vgl_homg_line_2d< double > > const &lines2, vgl_h_matrix_2d< double > &H)
 compute from matched lines.
virtual bool compute_l (vcl_vector< vgl_homg_line_2d< double > > const &lines1, vcl_vector< vgl_homg_line_2d< double > > const &lines2, vcl_vector< double > const &weights, vgl_h_matrix_2d< double > &H)
 compute from matched lines with weight vector.
virtual bool compute_pl (vcl_vector< vgl_homg_point_2d< double > > const &points1, vcl_vector< vgl_homg_point_2d< double > > const &points2, vcl_vector< vgl_homg_line_2d< double > > const &lines1, vcl_vector< vgl_homg_line_2d< double > > const &lines2, vgl_h_matrix_2d< double > &H)
 compute from matched points and lines.
bool solve_linear_problem (int equ_count, vcl_vector< vgl_homg_point_2d< double > > const &p1, vcl_vector< vgl_homg_point_2d< double > > const &p2, vgl_h_matrix_2d< double > &H)
 Assumes all corresponding points have equal weight.
bool solve_weighted_least_squares (vcl_vector< vgl_homg_line_2d< double > > const &l1, vcl_vector< vgl_homg_line_2d< double > > const &l2, vcl_vector< double > const &w, vgl_h_matrix_2d< double > &H)
 for lines, the solution should be weighted by line length.

Protected Attributes

bool verbose_

Private Attributes

bool allow_ideal_points_

Detailed Description

Definition at line 24 of file vgl_h_matrix_2d_compute_linear.h.


Constructor & Destructor Documentation

vgl_h_matrix_2d_compute_linear::vgl_h_matrix_2d_compute_linear ( bool  allow_ideal_points = false)

Construct a vgl_h_matrix_2d_compute_linear object.

The allow_ideal_points flag is described below.

Definition at line 16 of file vgl_h_matrix_2d_compute_linear.cxx.


Member Function Documentation

bool vgl_h_matrix_2d_compute::compute ( vcl_vector< vgl_homg_point_2d< double > > const &  points1,
vcl_vector< vgl_homg_point_2d< double > > const &  points2,
vgl_h_matrix_2d< double > &  H 
) [inline, inherited]

homography from matched points.

Definition at line 49 of file vgl_h_matrix_2d_compute.h.

bool vgl_h_matrix_2d_compute::compute ( vcl_vector< vgl_homg_line_2d< double > > const &  lines1,
vcl_vector< vgl_homg_line_2d< double > > const &  lines2,
vgl_h_matrix_2d< double > &  H 
) [inline, inherited]

homography from matched lines.

Definition at line 57 of file vgl_h_matrix_2d_compute.h.

bool vgl_h_matrix_2d_compute::compute ( vcl_vector< vgl_homg_line_2d< double > > const &  lines1,
vcl_vector< vgl_homg_line_2d< double > > const &  lines2,
vcl_vector< double > const &  weights,
vgl_h_matrix_2d< double > &  H 
) [inline, inherited]

homography from matched lines with a weight vector.

Definition at line 65 of file vgl_h_matrix_2d_compute.h.

bool vgl_h_matrix_2d_compute::compute ( vcl_vector< vgl_homg_point_2d< double > > const &  points1,
vcl_vector< vgl_homg_point_2d< double > > const &  points2,
vcl_vector< vgl_homg_line_2d< double > > const &  lines1,
vcl_vector< vgl_homg_line_2d< double > > const &  lines2,
vgl_h_matrix_2d< double > &  H 
) [inline, inherited]

homography from matched points and lines.

Definition at line 74 of file vgl_h_matrix_2d_compute.h.

vgl_h_matrix_2d<double> vgl_h_matrix_2d_compute::compute ( vcl_vector< vgl_homg_point_2d< double > > const &  p1,
vcl_vector< vgl_homg_point_2d< double > > const &  p2 
) [inline, inherited]

homography from matched points - return h_matrix.

Definition at line 85 of file vgl_h_matrix_2d_compute.h.

vgl_h_matrix_2d<double> vgl_h_matrix_2d_compute::compute ( vcl_vector< vgl_homg_line_2d< double > > const &  l1,
vcl_vector< vgl_homg_line_2d< double > > const &  l2 
) [inline, inherited]

homography from matched lines - return h_matrix.

Definition at line 91 of file vgl_h_matrix_2d_compute.h.

vgl_h_matrix_2d<double> vgl_h_matrix_2d_compute::compute ( vcl_vector< vgl_homg_line_2d< double > > const &  l1,
vcl_vector< vgl_homg_line_2d< double > > const &  l2,
vcl_vector< double > const &  weights 
) [inline, inherited]

homography from matched lines with weight vector - return h_matrix.

Definition at line 97 of file vgl_h_matrix_2d_compute.h.

vgl_h_matrix_2d<double> vgl_h_matrix_2d_compute::compute ( vcl_vector< vgl_homg_point_2d< double > > const &  p1,
vcl_vector< vgl_homg_point_2d< double > > const &  p2,
vcl_vector< vgl_homg_line_2d< double > > const &  l1,
vcl_vector< vgl_homg_line_2d< double > > const &  l2 
) [inline, inherited]

homography from matched points and lines - return h_matrix.

Definition at line 104 of file vgl_h_matrix_2d_compute.h.

bool vgl_h_matrix_2d_compute_linear::compute_l ( vcl_vector< vgl_homg_line_2d< double > > const &  lines1,
vcl_vector< vgl_homg_line_2d< double > > const &  lines2,
vgl_h_matrix_2d< double > &  H 
) [protected, virtual]

compute from matched lines.

Implements vgl_h_matrix_2d_compute.

Definition at line 156 of file vgl_h_matrix_2d_compute_linear.cxx.

bool vgl_h_matrix_2d_compute_linear::compute_l ( vcl_vector< vgl_homg_line_2d< double > > const &  lines1,
vcl_vector< vgl_homg_line_2d< double > > const &  lines2,
vcl_vector< double > const &  weights,
vgl_h_matrix_2d< double > &  H 
) [protected, virtual]

compute from matched lines with weight vector.

Implements vgl_h_matrix_2d_compute.

Definition at line 343 of file vgl_h_matrix_2d_compute_linear.cxx.

bool vgl_h_matrix_2d_compute_linear::compute_p ( vcl_vector< vgl_homg_point_2d< double > > const &  points1,
vcl_vector< vgl_homg_point_2d< double > > const &  points2,
vgl_h_matrix_2d< double > &  H 
) [protected, virtual]

compute from matched points.

Implements vgl_h_matrix_2d_compute.

Definition at line 113 of file vgl_h_matrix_2d_compute_linear.cxx.

bool vgl_h_matrix_2d_compute_linear::compute_pl ( vcl_vector< vgl_homg_point_2d< double > > const &  points1,
vcl_vector< vgl_homg_point_2d< double > > const &  points2,
vcl_vector< vgl_homg_line_2d< double > > const &  lines1,
vcl_vector< vgl_homg_line_2d< double > > const &  lines2,
vgl_h_matrix_2d< double > &  H 
) [protected, virtual]

compute from matched points and lines.

Implements vgl_h_matrix_2d_compute.

Definition at line 213 of file vgl_h_matrix_2d_compute_linear.cxx.

int vgl_h_matrix_2d_compute_linear::minimum_number_of_correspondences ( ) const [inline, virtual]

Implements vgl_h_matrix_2d_compute.

Definition at line 70 of file vgl_h_matrix_2d_compute_linear.h.

bool vgl_h_matrix_2d_compute_linear::solve_linear_problem ( int  equ_count,
vcl_vector< vgl_homg_point_2d< double > > const &  p1,
vcl_vector< vgl_homg_point_2d< double > > const &  p2,
vgl_h_matrix_2d< double > &  H 
) [protected]

Assumes all corresponding points have equal weight.

Compute a plane-plane projectivity using linear least squares.

Returns false if the calculation fails or there are fewer than four point matches in the list. The algorithm finds the nullvector of the $2 n \times 9$ design matrix:

\[ \left(\begin{array}{ccccccccc} 0 & 0 & 0 & x_1 z_1' & y_1 z_1' & z_1 z_1' & -x_1 y_1' & -y_1 y_1' & -z_1 y_1' \cr x_1 z_1' & y_1 z_1' & z_1 z_1' & 0 & 0 & 0 & -x_1 x_1' & -y_1 x_1' & -z_1 x_1' \cr \multicolumn{9}{c}{\cdots} \cr 0 & 0 & 0 & x_n z_n' & y_n z_n' & z_n z_n' & -x_n y_n' & -y_n y_n' & -z_n y_n'\cr x_n z_n' & y_n z_n' & z_n z_n' & 0 & 0 & 0 & -x_n x_n' & -y_n x_n' & -z_n x_n' \end{array}\right) \]

If allow_ideal_points was set at construction, the $3 \times 9$ version which allows for ideal points is used.

Definition at line 50 of file vgl_h_matrix_2d_compute_linear.cxx.

bool vgl_h_matrix_2d_compute_linear::solve_weighted_least_squares ( vcl_vector< vgl_homg_line_2d< double > > const &  l1,
vcl_vector< vgl_homg_line_2d< double > > const &  l2,
vcl_vector< double > const &  w,
vgl_h_matrix_2d< double > &  H 
) [protected]

for lines, the solution should be weighted by line length.

The solution equations should be weighted by the length of the corresponding line matches.

This weighting is given by w.

The two equations resulting from l1i<->l2i should be weighted by wi. Form a m x m diagonal matrix W with elements from w, with m = 2*Nc, where Nc=l1.size()=l2.size() is the number of corresponding line pairs. The weighted least squares problem is expressed as:

(D^tWD)x = Mx = 0

where D is the design matrix and x is the 9 element vector of unknown homography matrix elements. This problem can be solved using SVD as in the case of unweighted least squares.

Definition at line 279 of file vgl_h_matrix_2d_compute_linear.cxx.

void vgl_h_matrix_2d_compute::verbose ( bool  v) [inline, inherited]

Definition at line 37 of file vgl_h_matrix_2d_compute.h.


Member Data Documentation

Definition at line 26 of file vgl_h_matrix_2d_compute_linear.h.

bool vgl_h_matrix_2d_compute::verbose_ [protected, inherited]

Definition at line 111 of file vgl_h_matrix_2d_compute.h.


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