A class to hold a Fundamental Matrix of the general form and to perform common operations e.g. More...
#include <FMatrix.h>

Public Member Functions | |
| FMatrix () | |
| Default constructor. | |
| FMatrix (vcl_istream &f) | |
| Constructor. Load from vcl_istream. | |
| FMatrix (const double *f_matrix) | |
| Constructor. | |
| FMatrix (const vnl_matrix< double > &f_matrix) | |
| Constructor. | |
| FMatrix (const PMatrix &P1, const PMatrix &P2) | |
| Construct from two P matrices. | |
| FMatrix (const PMatrix &P2) | |
| Construct from one P matrix, the other is assumed to be [I 0]. | |
| FMatrix (const FMatrix &that) | |
| virtual | ~FMatrix () |
| Destructor. | |
| HomgLine2D | image1_epipolar_line (const HomgPoint2D &x2) const |
| Return the epipolar line $l_1$ in image 1: $l_1 = F^ x_2$. | |
| vgl_homg_line_2d< double > | image1_epipolar_line (vgl_homg_point_2d< double > const &x2) const |
| Return the epipolar line $l_1$ in image 1: $l_1 = F^ x_2$. | |
| HomgLine2D | image2_epipolar_line (const HomgPoint2D &x1) const |
| Return the epipolar line $l_2$ in image 2: $l_2 = F x_1$. | |
| vgl_homg_line_2d< double > | image2_epipolar_line (vgl_homg_point_2d< double > const &x1) const |
| Return the epipolar line $l_2$ in image 2: $l_2 = F x_1$. | |
| double | image1_epipolar_distance_squared (HomgPoint2D *point1_ptr, HomgPoint2D *point2_ptr) const |
| double | image1_epipolar_distance_squared (vgl_homg_point_2d< double > const &p1, vgl_homg_point_2d< double > const &p2) const |
| double | image2_epipolar_distance_squared (HomgPoint2D *point1_ptr, HomgPoint2D *point2_ptr) const |
| double | image2_epipolar_distance_squared (vgl_homg_point_2d< double > const &p1, vgl_homg_point_2d< double > const &p2) const |
| void | set_rank2_using_svd () |
| Ensure the current Fundamental matrix is rank 2. | |
| FMatrix | get_rank2_truncated () |
| FMatrix | transpose () const |
| Return an FMatrix which corresponds to the reverse of this one. | |
| bool | get_epipoles (HomgPoint2D *e1_out, HomgPoint2D *e2_out) const |
| Compute the epipoles (left and right nullspaces of F) using vnl_svd<double>. | |
| bool | get_epipoles (vgl_homg_point_2d< double > &e1_out, vgl_homg_point_2d< double > &e2_out) const |
| Compute the epipoles (left and right nullspaces of F) using vnl_svd<double>. | |
| void | decompose_to_skew_rank3 (vnl_matrix< double > *skew, vnl_matrix< double > *rank3) const |
| Decompose F to the product of a skew-symmetric matrix and a rank 3 matrix. | |
| void | find_nearest_perfect_match (const HomgPoint2D &in1, const HomgPoint2D &in2, HomgPoint2D *out1, HomgPoint2D *out2) const |
| Find nearest match which agrees with F. | |
| void | find_nearest_perfect_match (vgl_homg_point_2d< double > const &in1, vgl_homg_point_2d< double > const &in2, vgl_homg_point_2d< double > &out1, vgl_homg_point_2d< double > &out2) const |
| Find nearest match which agrees with F. | |
| void | find_nearest_perfect_match (const HomgPoint2D &in1, const HomgPoint2D &in2, const HomgPoint2D &e1, const HomgPoint2D &e2, HomgPoint2D *out1, HomgPoint2D *out2) const |
| Faster Hartley-Sturm using precomputed epipoles. | |
| void | find_nearest_perfect_match (vgl_homg_point_2d< double > const &in1, vgl_homg_point_2d< double > const &in2, vgl_homg_point_2d< double > const &e1, vgl_homg_point_2d< double > const &e2, vgl_homg_point_2d< double > &out1, vgl_homg_point_2d< double > &out2) const |
| Faster Hartley-Sturm using precomputed epipoles. | |
| void | compute_P_matrix (vnl_matrix< double > &P2) const |
| void | compute_P_matrix (PMatrix &P2) const |
| void | compute_P_matrix (vgl_p_matrix< double > &P2) const |
| double | get (unsigned int row_index, unsigned int col_index) const |
| Return the element of the matrix at the specified indices (zero-based). | |
| virtual bool | set (const double *f_matrix) |
| Set the fundamental matrix using the C-storage array c_matrix, and cache the transpose. | |
| void | get (double *f_matrix) const |
| Copy the fundamental matrix into a 2D array of doubles for `C' compatibility. | |
| virtual bool | set (const vnl_matrix< double > &f_matrix) |
| Set the fundamental matrix using the vnl_matrix<double> f_matrix. | |
| void | get (vnl_matrix< double > *f_matrix) const |
| Copy the fundamental matrix into a vnl_matrix<double>. | |
| void | set (const PMatrix &P1, const PMatrix &P2) |
| Set from two P matrices. | |
| void | set (const PMatrix &P2) |
| Set from one P matrix, the second. The first is assumed to be [I O]. | |
| void | set (const FMatrix &) |
| Set from one P matrix, the second. The first is assumed to be [I O]. | |
| const vnl_double_3x3 & | get_matrix () const |
| Return a const reference to the internal 3x3 matrix. | |
| const vnl_double_3x3 & | get_transpose_matrix () const |
| Return a const reference to the transpose of the internal 3x3 matrix. | |
| bool | get_rank2_flag (void) const |
| Return the rank2_flag_. | |
| void | set_rank2_flag (bool rank2_flag) |
| Set the rank2_flag_. | |
| bool | read_ascii (vcl_istream &f) |
| Read from ASCII vcl_istream. | |
Static Public Member Functions | |
| static FMatrix | read (char const *filename) |
| static FMatrix | read (vcl_istream &s) |
| Read from ASCII vcl_istream. | |
Protected Attributes | |
| vnl_double_3x3 | f_matrix_ |
| vnl_double_3x3 | ft_matrix_ |
| bool | rank2_flag_ |
Friends | |
| vcl_ostream & | operator<< (vcl_ostream &s, const FMatrix &F) |
| Print to vcl_ostream. | |
| vcl_istream & | operator>> (vcl_istream &s, FMatrix &F) |
| Read from ASCII vcl_istream. | |
A class to hold a Fundamental Matrix of the general form and to perform common operations e.g.
generate epipolar lines
| FMatrix::FMatrix | ( | ) |
Default constructor.
Sets matrices to size 3x3, zero-filled.
Definition at line 33 of file FMatrix.cxx.
| FMatrix::FMatrix | ( | vcl_istream & | f | ) |
Constructor. Load from vcl_istream.
Definition at line 42 of file FMatrix.cxx.
| FMatrix::FMatrix | ( | const double * | f_matrix | ) |
Constructor.
Definition at line 52 of file FMatrix.cxx.
| FMatrix::FMatrix | ( | const vnl_matrix< double > & | f_matrix | ) |
Constructor.
Definition at line 62 of file FMatrix.cxx.
Construct from two P matrices.
Definition at line 73 of file FMatrix.cxx.
| FMatrix::FMatrix | ( | const PMatrix & | P2 | ) |
Construct from one P matrix, the other is assumed to be [I 0].
Definition at line 83 of file FMatrix.cxx.
| FMatrix::~FMatrix | ( | ) | [virtual] |
Destructor.
Definition at line 92 of file FMatrix.cxx.
| void FMatrix::compute_P_matrix | ( | vnl_matrix< double > & | P2 | ) | const |
Definition at line 562 of file FMatrix.cxx.
| void FMatrix::compute_P_matrix | ( | PMatrix & | P2 | ) | const [inline] |
| void FMatrix::compute_P_matrix | ( | vgl_p_matrix< double > & | P2 | ) | const [inline] |
| void FMatrix::decompose_to_skew_rank3 | ( | vnl_matrix< double > * | skew, |
| vnl_matrix< double > * | rank3 | ||
| ) | const |
Decompose F to the product of a skew-symmetric matrix and a rank 3 matrix.
Reimplemented in FMatrixSkew.
Definition at line 598 of file FMatrix.cxx.
| void FMatrix::find_nearest_perfect_match | ( | const HomgPoint2D & | point1, |
| const HomgPoint2D & | point2, | ||
| HomgPoint2D * | perfect_point1_ptr, | ||
| HomgPoint2D * | perfect_point2_ptr | ||
| ) | const |
Find nearest match which agrees with F.
For a specified pair of matching points, find the nearest (minimum sum of squared image distances) match which is in perfect agreement with the epipolar geometry of the F matrix. (see R.I. Hartley and P. Sturm, ``Triangulation''. In {Proceedings, Computer Analysis of Images and Patterns}, Prague, 1995).
Reimplemented in FMatrixSkew, and FMatrixPlanar.
Definition at line 314 of file FMatrix.cxx.
| void FMatrix::find_nearest_perfect_match | ( | vgl_homg_point_2d< double > const & | point1, |
| vgl_homg_point_2d< double > const & | point2, | ||
| vgl_homg_point_2d< double > & | perfect_point1, | ||
| vgl_homg_point_2d< double > & | perfect_point2 | ||
| ) | const |
Find nearest match which agrees with F.
For a specified pair of matching points, find the nearest (minimum sum of squared image distances) match which is in perfect agreement with the epipolar geometry of the F matrix. (see R.I. Hartley and P. Sturm, ``Triangulation''. In {Proceedings, Computer Analysis of Images and Patterns}, Prague, 1995).
Reimplemented in FMatrixSkew, and FMatrixPlanar.
Definition at line 292 of file FMatrix.cxx.
| void FMatrix::find_nearest_perfect_match | ( | const HomgPoint2D & | in1, |
| const HomgPoint2D & | in2, | ||
| const HomgPoint2D & | e1, | ||
| const HomgPoint2D & | e2, | ||
| HomgPoint2D * | out1, | ||
| HomgPoint2D * | out2 | ||
| ) | const |
Faster Hartley-Sturm using precomputed epipoles.
Definition at line 442 of file FMatrix.cxx.
| void FMatrix::find_nearest_perfect_match | ( | vgl_homg_point_2d< double > const & | in1, |
| vgl_homg_point_2d< double > const & | in2, | ||
| vgl_homg_point_2d< double > const & | e1, | ||
| vgl_homg_point_2d< double > const & | e2, | ||
| vgl_homg_point_2d< double > & | out1, | ||
| vgl_homg_point_2d< double > & | out2 | ||
| ) | const |
Faster Hartley-Sturm using precomputed epipoles.
Definition at line 327 of file FMatrix.cxx.
| double FMatrix::get | ( | unsigned int | row_index, |
| unsigned int | col_index | ||
| ) | const |
Return the element of the matrix at the specified indices (zero-based).
Definition at line 608 of file FMatrix.cxx.
| void FMatrix::get | ( | double * | f_matrix | ) | const |
Copy the fundamental matrix into a 2D array of doubles for `C' compatibility.
Definition at line 617 of file FMatrix.cxx.
| void FMatrix::get | ( | vnl_matrix< double > * | f_matrix | ) | const |
Copy the fundamental matrix into a vnl_matrix<double>.
Definition at line 627 of file FMatrix.cxx.
| bool FMatrix::get_epipoles | ( | HomgPoint2D * | epipole1_ptr, |
| HomgPoint2D * | epipole2_ptr | ||
| ) | const |
Compute the epipoles (left and right nullspaces of F) using vnl_svd<double>.
Return false if the rank of F is not 2, and set approximate epipoles, (the left and right singular vectors corresponding to the smallest singular value of F).
Reimplemented in FMatrixSkew.
Definition at line 271 of file FMatrix.cxx.
| bool FMatrix::get_epipoles | ( | vgl_homg_point_2d< double > & | epipole1, |
| vgl_homg_point_2d< double > & | epipole2 | ||
| ) | const |
Compute the epipoles (left and right nullspaces of F) using vnl_svd<double>.
Return false if the rank of F is not 2, and set approximate epipoles, (the left and right singular vectors corresponding to the smallest singular value of F).
Reimplemented in FMatrixSkew.
Definition at line 253 of file FMatrix.cxx.
| const vnl_double_3x3& FMatrix::get_matrix | ( | ) | const [inline] |
| bool FMatrix::get_rank2_flag | ( | void | ) | const |
Return the rank2_flag_.
Reimplemented in FMatrixSkew, and FMatrixPlanar.
Definition at line 636 of file FMatrix.cxx.
| FMatrix FMatrix::get_rank2_truncated | ( | ) |
Reimplemented in FMatrixPlanar, and FMatrixSkew.
| const vnl_double_3x3& FMatrix::get_transpose_matrix | ( | ) | const [inline] |
| double FMatrix::image1_epipolar_distance_squared | ( | HomgPoint2D * | point1_ptr, |
| HomgPoint2D * | point2_ptr | ||
| ) | const |
Definition at line 192 of file FMatrix.cxx.
| double FMatrix::image1_epipolar_distance_squared | ( | vgl_homg_point_2d< double > const & | p1, |
| vgl_homg_point_2d< double > const & | p2 | ||
| ) | const |
Definition at line 179 of file FMatrix.cxx.
| HomgLine2D FMatrix::image1_epipolar_line | ( | const HomgPoint2D & | x2 | ) | const |
Return the epipolar line $l_1$ in image 1: $l_1 = F^ x_2$.
Definition at line 149 of file FMatrix.cxx.
| vgl_homg_line_2d< double > FMatrix::image1_epipolar_line | ( | vgl_homg_point_2d< double > const & | x2 | ) | const |
Return the epipolar line $l_1$ in image 1: $l_1 = F^ x_2$.
Definition at line 140 of file FMatrix.cxx.
| double FMatrix::image2_epipolar_distance_squared | ( | HomgPoint2D * | point1_ptr, |
| HomgPoint2D * | point2_ptr | ||
| ) | const |
Definition at line 218 of file FMatrix.cxx.
| double FMatrix::image2_epipolar_distance_squared | ( | vgl_homg_point_2d< double > const & | p1, |
| vgl_homg_point_2d< double > const & | p2 | ||
| ) | const |
Definition at line 205 of file FMatrix.cxx.
| HomgLine2D FMatrix::image2_epipolar_line | ( | const HomgPoint2D & | x1 | ) | const |
Return the epipolar line $l_2$ in image 2: $l_2 = F x_1$.
Definition at line 168 of file FMatrix.cxx.
| vgl_homg_line_2d< double > FMatrix::image2_epipolar_line | ( | vgl_homg_point_2d< double > const & | x1 | ) | const |
Return the epipolar line $l_2$ in image 2: $l_2 = F x_1$.
Definition at line 158 of file FMatrix.cxx.
| FMatrix FMatrix::read | ( | char const * | filename | ) | [static] |
Definition at line 111 of file FMatrix.cxx.
| FMatrix FMatrix::read | ( | vcl_istream & | s | ) | [static] |
Read from ASCII vcl_istream.
Definition at line 130 of file FMatrix.cxx.
| bool FMatrix::read_ascii | ( | vcl_istream & | f | ) |
Read from ASCII vcl_istream.
Definition at line 98 of file FMatrix.cxx.
| bool FMatrix::set | ( | const double * | c_matrix | ) | [virtual] |
Set the fundamental matrix using the C-storage array c_matrix, and cache the transpose.
Always returns true for the base class - showing the set was a success. When overridden by derived classes it may return false, to indicate that the matrix violates the constraints imposed by the derived classes.
Reimplemented in FMatrixSkew, FMatrixPlanar, and FMatrixAffine.
Definition at line 657 of file FMatrix.cxx.
| bool FMatrix::set | ( | const vnl_matrix< double > & | f_matrix | ) | [virtual] |
Set the fundamental matrix using the vnl_matrix<double> f_matrix.
Always returns true for the base class - showing the set was a success. When overridden by derived classes it may return false, to indicate that the matrix violates the constraints imposed by the derived classes.
Reimplemented in FMatrixSkew, FMatrixPlanar, and FMatrixAffine.
Definition at line 676 of file FMatrix.cxx.
Set from two P matrices.
Definition at line 685 of file FMatrix.cxx.
| void FMatrix::set | ( | const PMatrix & | P2 | ) |
Set from one P matrix, the second. The first is assumed to be [I O].
Definition at line 695 of file FMatrix.cxx.
| void FMatrix::set | ( | const FMatrix & | F | ) |
Set from one P matrix, the second. The first is assumed to be [I O].
Definition at line 707 of file FMatrix.cxx.
| void FMatrix::set_rank2_flag | ( | bool | rank2_flag | ) |
| void FMatrix::set_rank2_using_svd | ( | void | ) |
Ensure the current Fundamental matrix is rank 2.
Does this by taking its vnl_svd<double>, setting the smallest singular value to zero, and recomposing. Sets the rank2_flag_ to true.
Reimplemented in FMatrixPlanar, and FMatrixSkew.
Definition at line 583 of file FMatrix.cxx.
| FMatrix FMatrix::transpose | ( | ) | const |
Return an FMatrix which corresponds to the reverse of this one.
Definition at line 242 of file FMatrix.cxx.
| vcl_ostream& operator<< | ( | vcl_ostream & | s, |
| const FMatrix & | F | ||
| ) | [friend] |
Print to vcl_ostream.
Definition at line 227 of file FMatrix.cxx.
| vcl_istream& operator>> | ( | vcl_istream & | s, |
| FMatrix & | F | ||
| ) | [friend] |
Read from ASCII vcl_istream.
Definition at line 122 of file FMatrix.cxx.
vnl_double_3x3 FMatrix::f_matrix_ [protected] |
vnl_double_3x3 FMatrix::ft_matrix_ [protected] |
bool FMatrix::rank2_flag_ [protected] |
1.7.5.1