Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends
PMatrixDec Class Reference

#include <PMatrixDec.h>

Inheritance diagram for PMatrixDec:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 PMatrixDec (const vnl_matrix< double > &p_matrix)
 Constructor.
 ~PMatrixDec ()
 Destructor.
const vnl_matrix< double > & IntrinsicParameters ()
const vnl_matrix< double > & ExtrinsicParameters ()
double GetAlphaU () const
double GetAlphaV () const
double GetU0 () const
double GetV0 () const
void Test ()
 Test --.
HomgPoint2D project (const HomgPoint3D &X) const
 Return the image point which is the projection of the specified 3D point X.
HomgLine2D project (const HomgLine3D &L) const
HomgLineSeg2D project (const HomgLineSeg3D &L) const
vgl_homg_point_2d< double > project (vgl_homg_point_3d< double > const &X) const
 Return the image point which is the projection of the specified 3D point X.
vgl_homg_line_2d< double > project (vgl_homg_line_3d_2_points< double > const &L) const
 Return the image line which is the projection of the specified 3D line L.
vgl_line_segment_2d< double > project (vgl_line_segment_3d< double > const &L) const
 Return the image linesegment which is the projection of the specified 3D linesegment L.
HomgPoint3D backproject_pseudoinverse (const HomgPoint2D &x) const
vgl_homg_point_3d< double > backproject_pseudoinverse (vgl_homg_point_2d< double > const &x) const
 Return the 3D point $ X$ which is $ X = P^+ x$.
HomgLine3D backproject (const HomgPoint2D &x) const
HomgPlane3D backproject (const HomgLine2D &l) const
vgl_homg_line_3d_2_points< double > backproject (vgl_homg_point_2d< double > const &x) const
 Return the 3D line which is the backprojection of the specified image point, x.
vgl_homg_plane_3d< double > backproject (vgl_homg_line_2d< double > const &l) const
 Return the 3D plane which is the backprojection of the specified line l in the image.
PMatrix postmultiply (vnl_double_4x4 const &H) const
 post-multiply this projection matrix with a HMatrix3D.
PMatrix premultiply (vnl_double_3x3 const &H) const
 pre-multiply this projection matrix with a HMatrix2D.
vnl_svd< double > * svd () const
 Compute the svd of this P and cache it, so that future operations that require it need not recompute it.
void clear_svd () const
 Discredit the cached svd.
HomgPoint3D get_focal_point () const
vgl_homg_point_3d< double > get_focal () const
 Return the 3D point representing the focal point of the camera.
HMatrix3D get_canonical_H () const
 Return the HMatrix3D s.t. P * H = [I 0].
bool is_canonical (double tol=0) const
 Return true iff P is [I 0].
bool is_behind_camera (const HomgPoint3D &)
bool is_behind_camera (vgl_homg_point_3d< double > const &)
 Return true if the 3D point X is behind the camera represented by this P.
void flip_sign ()
 Change the overall sign of the P matrix.
bool looks_conditioned ()
 Splendid hack that tries to detect if the P is an image-coords P or a normalized P.
void fix_cheirality ()
 Scale P so determinant of first 3x3 is 1.
bool operator== (PMatrix const &p) const
void get (vnl_matrix< double > *A, vnl_vector< double > *a) const
 Return the 3x3 matrix and 3x1 column vector of P = [A a].
void get (vnl_double_3x3 *A, vnl_double_3 *a) const
 Return the 3x3 matrix and 3x1 column vector of P = [A a].
double get (unsigned int row_index, unsigned int col_index) const
 Return the element of the matrix at the specified indices.
void get (double *c_matrix) const
 Return the 3x4 projection matrix in the array, p_matrix.
void get (vnl_matrix< double > *p_matrix) const
void get (vnl_double_3x4 *p_matrix) const
 Return the 3x4 projection matrix in the vnl_matrix<double>, p_matrix.
void set (vnl_double_3x3 const &A, vnl_double_3 const &a)
 Set from 3x3 matrix and 3x1 column vector of P = [A a].
void set (const double *p_matrix)
 Set the 3x4 projective matrix with the matrix in the array, p_matrix.
void set (const double p_matrix[3][4])
 Set the 3x4 projective matrix with the matrix in the array, p_matrix.
void set (const vnl_matrix< double > &p_matrix)
 Set the 3x4 projective matrix with the matrix in the array, p_matrix.
void set (vnl_double_3x4 const &p_matrix)
 Set the fundamental matrix using the vnl_matrix<double> p_matrix.
void get_rows (vnl_vector< double > *, vnl_vector< double > *, vnl_vector< double > *) const
 Return the rows of P = [a b c]'.
void get_rows (vnl_double_4 *, vnl_double_4 *, vnl_double_4 *) const
 Return the rows of P = [a b c]'.
void set_rows (const vnl_vector< double > &, const vnl_vector< double > &, const vnl_vector< double > &)
const vnl_double_3x4get_matrix () const
bool read_ascii (vcl_istream &f)
 Load from file.
void ref ()
void unref ()
int get_references () const
bool is_referenced () const

Static Public Member Functions

static PMatrix read (const char *filename)
 Load from file.
static PMatrix read (vcl_istream &)
 Load from vcl_istream.

Protected Attributes

vnl_double_3x4 p_matrix_
vnl_svd< double > * svd_

Private Member Functions

void Init ()
 Auxiliary Constructor.

Private Attributes

vnl_matrix< double > j_matrix_
vnl_matrix< double > d_matrix_

Friends

vcl_ostream & operator<< (vcl_ostream &s, const PMatrixDec &P)
 Print to vcl_ostream.

Detailed Description

Definition at line 40 of file PMatrixDec.h.


Constructor & Destructor Documentation

PMatrixDec::PMatrixDec ( const vnl_matrix< double > &  p_matrix)

Constructor.

Definition at line 16 of file PMatrixDec.cxx.

PMatrixDec::~PMatrixDec ( )

Destructor.

Definition at line 28 of file PMatrixDec.cxx.


Member Function Documentation

HomgLine3D PMatrix::backproject ( const HomgPoint2D x) const [inherited]

Definition at line 184 of file PMatrix.cxx.

HomgPlane3D PMatrix::backproject ( const HomgLine2D l) const [inherited]

Definition at line 197 of file PMatrix.cxx.

vgl_homg_line_3d_2_points< double > PMatrix::backproject ( vgl_homg_point_2d< double > const &  x) const [inherited]

Return the 3D line which is the backprojection of the specified image point, x.

Uses svd().

Definition at line 179 of file PMatrix.cxx.

vgl_homg_plane_3d< double > PMatrix::backproject ( vgl_homg_line_2d< double > const &  l) const [inherited]

Return the 3D plane which is the backprojection of the specified line l in the image.

Definition at line 192 of file PMatrix.cxx.

HomgPoint3D PMatrix::backproject_pseudoinverse ( const HomgPoint2D x) const [inherited]

Definition at line 170 of file PMatrix.cxx.

vgl_homg_point_3d< double > PMatrix::backproject_pseudoinverse ( vgl_homg_point_2d< double > const &  x) const [inherited]

Return the 3D point $ X$ which is $ X = P^+ x$.

Equivalently, the 3D point of smallest norm such that $P \vec X = \vec x$. Uses svd().

Definition at line 164 of file PMatrix.cxx.

void PMatrix::clear_svd ( ) const [inherited]

Discredit the cached svd.

This is necessary only in order to recover the space used by it if the PMatrix is not being deleted.

Definition at line 289 of file PMatrix.cxx.

const vnl_matrix<double>& PMatrixDec::ExtrinsicParameters ( ) [inline]

Definition at line 55 of file PMatrixDec.h.

void PMatrix::fix_cheirality ( ) [inherited]

Scale P so determinant of first 3x3 is 1.

Definition at line 563 of file PMatrix.cxx.

void PMatrix::flip_sign ( ) [inherited]

Change the overall sign of the P matrix.

Definition at line 612 of file PMatrix.cxx.

void PMatrix::get ( vnl_matrix< double > *  A,
vnl_vector< double > *  a 
) const [inherited]

Return the 3x3 matrix and 3x1 column vector of P = [A a].

Definition at line 401 of file PMatrix.cxx.

void PMatrix::get ( vnl_double_3x3 A,
vnl_double_3 *  a 
) const [inherited]

Return the 3x3 matrix and 3x1 column vector of P = [A a].

Definition at line 424 of file PMatrix.cxx.

double PMatrix::get ( unsigned int  row_index,
unsigned int  col_index 
) const [inherited]

Return the element of the matrix at the specified indices.

Definition at line 372 of file PMatrix.cxx.

void PMatrix::get ( double *  c_matrix) const [inherited]

Return the 3x4 projection matrix in the array, p_matrix.

Definition at line 381 of file PMatrix.cxx.

void PMatrix::get ( vnl_matrix< double > *  p_matrix) const [inherited]
void PMatrix::get ( vnl_double_3x4 p_matrix) const [inherited]

Return the 3x4 projection matrix in the vnl_matrix<double>, p_matrix.

Definition at line 392 of file PMatrix.cxx.

HMatrix3D PMatrix::get_canonical_H ( ) const [inherited]

Return the HMatrix3D s.t. P * H = [I 0].

If P = [A a], then H = [inv(A) -inv(A)*a; 0 0 0 1];

Definition at line 335 of file PMatrix.cxx.

vgl_homg_point_3d< double > PMatrix::get_focal ( ) const [inherited]

Return the 3D point representing the focal point of the camera.

Uses svd().

Definition at line 298 of file PMatrix.cxx.

HomgPoint3D PMatrix::get_focal_point ( ) const [inherited]

Definition at line 312 of file PMatrix.cxx.

const vnl_double_3x4& PMatrix::get_matrix ( ) const [inline, inherited]

Definition at line 140 of file PMatrix.h.

void PMatrix::get_rows ( vnl_vector< double > *  a,
vnl_vector< double > *  b,
vnl_vector< double > *  c 
) const [inherited]

Return the rows of P = [a b c]'.

Definition at line 447 of file PMatrix.cxx.

void PMatrix::get_rows ( vnl_double_4 *  a,
vnl_double_4 *  b,
vnl_double_4 *  c 
) const [inherited]

Return the rows of P = [a b c]'.

Definition at line 469 of file PMatrix.cxx.

double PMatrixDec::GetAlphaU ( ) const [inline]

Definition at line 57 of file PMatrixDec.h.

double PMatrixDec::GetAlphaV ( ) const [inline]

Definition at line 58 of file PMatrixDec.h.

double PMatrixDec::GetU0 ( ) const [inline]

Definition at line 59 of file PMatrixDec.h.

double PMatrixDec::GetV0 ( ) const [inline]

Definition at line 60 of file PMatrixDec.h.

void PMatrixDec::Init ( ) [private]

Auxiliary Constructor.

Definition at line 34 of file PMatrixDec.cxx.

const vnl_matrix<double>& PMatrixDec::IntrinsicParameters ( ) [inline]

Definition at line 54 of file PMatrixDec.h.

bool PMatrix::is_behind_camera ( const HomgPoint3D hX) [inherited]

Definition at line 597 of file PMatrix.cxx.

bool PMatrix::is_behind_camera ( vgl_homg_point_3d< double > const &  hX) [inherited]

Return true if the 3D point X is behind the camera represented by this P.

This depends on the overall sign of the P matrix having been set correctly, a la Hartley cheirality paper.

Definition at line 587 of file PMatrix.cxx.

bool PMatrix::is_canonical ( double  tol = 0) const [inherited]

Return true iff P is [I 0].

Equality is assumed if the max abs diff is less than tol.

Definition at line 349 of file PMatrix.cxx.

bool PMatrix::looks_conditioned ( ) [inherited]

Splendid hack that tries to detect if the P is an image-coords P or a normalized P.

Definition at line 621 of file PMatrix.cxx.

bool PMatrix::operator== ( PMatrix const &  p) const [inline, inherited]

Definition at line 120 of file PMatrix.h.

PMatrix PMatrix::postmultiply ( vnl_double_4x4 const &  H) const [inherited]

post-multiply this projection matrix with a HMatrix3D.

Postmultiply by 4x4 matrix.

Definition at line 629 of file PMatrix.cxx.

PMatrix PMatrix::premultiply ( vnl_double_3x3 const &  H) const [inherited]

pre-multiply this projection matrix with a HMatrix2D.

Premultiply by 3x3 matrix.

Definition at line 635 of file PMatrix.cxx.

HomgPoint2D PMatrix::project ( const HomgPoint3D X) const [inherited]

Return the image point which is the projection of the specified 3D point X.

Definition at line 123 of file PMatrix.cxx.

HomgLine2D PMatrix::project ( const HomgLine3D L) const [inherited]

Definition at line 138 of file PMatrix.cxx.

HomgLineSeg2D PMatrix::project ( const HomgLineSeg3D L) const [inherited]

Definition at line 154 of file PMatrix.cxx.

vgl_homg_point_2d<double> PMatrix::project ( vgl_homg_point_3d< double > const &  X) const [inline, inherited]

Return the image point which is the projection of the specified 3D point X.

Definition at line 84 of file PMatrix.h.

vgl_homg_line_2d< double > PMatrix::project ( vgl_homg_line_3d_2_points< double > const &  L) const [inherited]

Return the image line which is the projection of the specified 3D line L.

Definition at line 133 of file PMatrix.cxx.

vgl_line_segment_2d< double > PMatrix::project ( vgl_line_segment_3d< double > const &  L) const [inherited]

Return the image linesegment which is the projection of the specified 3D linesegment L.

Definition at line 147 of file PMatrix.cxx.

PMatrix PMatrix::read ( const char *  filename) [static, inherited]

Load from file.

Static method, so you can say

 PMatrix P = PMatrix::read("file.P");

Definition at line 250 of file PMatrix.cxx.

PMatrix PMatrix::read ( vcl_istream &  s) [static, inherited]

Load from vcl_istream.

Definition at line 266 of file PMatrix.cxx.

bool PMatrix::read_ascii ( vcl_istream &  f) [inherited]

Load from file.

 P.read_ascii("file.P");

Definition at line 226 of file PMatrix.cxx.

void PMatrix::set ( vnl_double_3x3 const &  A,
vnl_double_3 const &  a 
) [inherited]

Set from 3x3 matrix and 3x1 column vector of P = [A a].

Definition at line 542 of file PMatrix.cxx.

void PMatrix::set ( const double *  p_matrix) [inherited]

Set the 3x4 projective matrix with the matrix in the array, p_matrix.

Definition at line 518 of file PMatrix.cxx.

void PMatrix::set ( const double  p_matrix[3][4]) [inherited]

Set the 3x4 projective matrix with the matrix in the array, p_matrix.

Definition at line 493 of file PMatrix.cxx.

void PMatrix::set ( const vnl_matrix< double > &  p_matrix) [inherited]

Set the 3x4 projective matrix with the matrix in the array, p_matrix.

Definition at line 504 of file PMatrix.cxx.

void PMatrix::set ( vnl_double_3x4 const &  p_matrix) [inherited]

Set the fundamental matrix using the vnl_matrix<double> p_matrix.

Definition at line 531 of file PMatrix.cxx.

void PMatrix::set_rows ( const vnl_vector< double > &  ,
const vnl_vector< double > &  ,
const vnl_vector< double > &   
) [inherited]
vnl_svd< double > * PMatrix::svd ( ) const [inherited]

Compute the svd of this P and cache it, so that future operations that require it need not recompute it.

Definition at line 278 of file PMatrix.cxx.

void PMatrixDec::Test ( )

Test --.

Definition at line 110 of file PMatrixDec.cxx.


Friends And Related Function Documentation

vcl_ostream& operator<< ( vcl_ostream &  s,
const PMatrixDec P 
) [friend]

Print to vcl_ostream.

Definition at line 97 of file PMatrixDec.cxx.


Member Data Documentation

vnl_matrix<double> PMatrixDec::d_matrix_ [private]

Definition at line 46 of file PMatrixDec.h.

vnl_matrix<double> PMatrixDec::j_matrix_ [private]

Definition at line 45 of file PMatrixDec.h.

vnl_double_3x4 PMatrix::p_matrix_ [protected, inherited]

Definition at line 147 of file PMatrix.h.

vnl_svd<double>* PMatrix::svd_ [mutable, protected, inherited]

Definition at line 148 of file PMatrix.h.


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