Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members

vgl_p_matrix< T > Class Template Reference

#include <vgl_p_matrix.h>

List of all members.


Detailed Description

template<class T>
class vgl_p_matrix< T >

Definition at line 47 of file vgl_p_matrix.h.

Public Member Functions

 vgl_p_matrix ()
 Constructor. Set up a canonical P matrix.
 vgl_p_matrix (vcl_istream &)
 Construct by loading from vcl_istream.
 vgl_p_matrix (const T *c_matrix)
 Construct from row-stored C-array of 12 elements.
 vgl_p_matrix (vnl_matrix_fixed< T, 3, 4 > const &P)
 Construct from 3x4 matrix.
 vgl_p_matrix (const vnl_matrix< T > &A, const vnl_vector< T > &a)
 Construct from 3x3 matrix A and vector a. P = [A a].
 vgl_p_matrix (const vgl_p_matrix &P)
 ~vgl_p_matrix ()
vgl_homg_point_2d< T > operator() (vgl_homg_point_3d< T > const &X) const
 Return the image point which is the projection of the specified 3D point X.
vgl_homg_point_2d< T > operator * (vgl_homg_point_3d< T > const &X) const
 Return the image point which is the projection of the specified 3D point X.
vgl_homg_line_2d< T > operator() (vgl_homg_line_3d_2_points< T > const &L) const
 Return the image line which is the projection of the specified 3D line L.
vgl_homg_line_2d< T > operator * (vgl_homg_line_3d_2_points< T > const &L) const
 Return the image line which is the projection of the specified 3D line L.
vgl_line_segment_2d< T > operator() (vgl_line_segment_3d< T > const &L) const
 Return the image linesegment which is the projection of the specified 3D linesegment L.
vgl_line_segment_2d< T > operator * (vgl_line_segment_3d< T > const &L) const
 Return the image linesegment which is the projection of the specified 3D linesegment L.
vgl_homg_point_3d< T > backproject_pseudoinverse (vgl_homg_point_2d< T > const &x) const
 Return the 3D point $ X$ which is $ X = P^+ x$.
vgl_homg_line_3d_2_points< T > backproject (vgl_homg_point_2d< T > const &x) const
 Return the 3D line which is the backprojection of the specified image point, x.
vgl_homg_plane_3d< T > backproject (vgl_homg_line_2d< T > const &l) const
 Return the 3D plane which is the backprojection of the specified line l in the image.
vgl_p_matrix< T > postmultiply (vnl_matrix_fixed< T, 4, 4 > const &H) const
 post-multiply this projection matrix with a 3-d projective transform.
vgl_p_matrix< T > premultiply (vnl_matrix_fixed< T, 3, 3 > const &H) const
 pre-multiply this projection matrix with a 2-d projective transform.
vgl_p_matrix< T > operator * (vnl_matrix_fixed< T, 3, 3 > const &C) const
 pre-multiply this projection matrix with a 2-d projective transform.
vnl_svd< T > * 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.
vgl_homg_point_3d< T > get_focal () const
 Return the 3D point representing the focal point of the camera.
vgl_h_matrix_3d< T > get_canonical_H () const
 Return the 3D H-matrix s.t. P * H = [I 0].
bool is_canonical (T tol=0) const
 Return true iff P is [I 0].
bool is_behind_camera (vgl_homg_point_3d< T > 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.
vgl_p_matrixoperator= (const vgl_p_matrix &)
bool operator== (vgl_p_matrix const &p) const
void get (vnl_matrix< T > *A, vnl_vector< T > *a) const
 Return the 3x3 matrix and 3x1 column vector of P = [A a].
void get (vnl_matrix_fixed< T, 3, 3 > *A, vnl_vector_fixed< T, 3 > *a) const
 Return the 3x3 matrix and 3x1 column vector of P = [A a].
void get_rows (vnl_vector< T > *a, vnl_vector< T > *b, vnl_vector< T > *c) const
 Return the rows of P = [a b c]'.
void get_rows (vnl_vector_fixed< T, 4 > *a, vnl_vector_fixed< T, 4 > *b, vnl_vector_fixed< T, 4 > *c) const
 Return the rows of P = [a b c]'.
void set_rows (const vnl_vector< T > &a, const vnl_vector< T > &b, const vnl_vector< T > &c)
 Set P = [a b c]' from its rows a, b, c.
get (unsigned int row_index, unsigned int col_index) const
 Return the element of the matrix at the specified index pair.
void get (T *c_matrix) const
 Return the 3x4 projection matrix in the C-array, c_matrix.
void get (vnl_matrix< T > &p_matrix) const
 Return the 3x4 projection matrix in p_matrix.
void get (vnl_matrix_fixed< T, 3, 4 > &p_matrix) const
 Return the 3x4 projection matrix in p_matrix.
void set (const T *p_matrix)
 Set the 3x4 projective matrix with the matrix in the C-array, p_matrix.
void set (const T p_matrix[3][4])
 Set the 3x4 projective matrix with the matrix in the C-array, p_matrix.
void set (const vnl_matrix< T > &p_matrix)
 Set the internal matrix using the vnl_matrix<double> p_matrix.
void set (vnl_matrix_fixed< T, 3, 4 > const &p_matrix)
 Set the internal matrix using the vnl_matrix<double> p_matrix.
void set (const vnl_matrix< T > &A, const vnl_vector< T > &a)
 Set from 3x3 matrix and 3x1 column vector of P = [A a].
const vnl_matrix_fixed< T, 3, 4 > & get_matrix () const
void set_identity ()
 Set the camera to an identity projection. X->u, Y->v.
bool read_ascii (vcl_istream &f)
 Load from file.

Static Public Member Functions

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

Protected Attributes

vnl_matrix_fixed< T, 3, 4 > p_matrix_
vnl_svd< T > * svd_


Constructor & Destructor Documentation

template<class T>
vgl_p_matrix< T >::vgl_p_matrix  ) 
 

Constructor. Set up a canonical P matrix.

Definition at line 23 of file vgl_p_matrix.txx.

template<class T>
vgl_p_matrix< T >::vgl_p_matrix vcl_istream &   ) 
 

Construct by loading from vcl_istream.

   vgl_p_matrix P(cin);

Definition at line 37 of file vgl_p_matrix.txx.

template<class T>
vgl_p_matrix< T >::vgl_p_matrix const T *  c_matrix  ) 
 

Construct from row-stored C-array of 12 elements.

Definition at line 63 of file vgl_p_matrix.txx.

template<class T>
vgl_p_matrix< T >::vgl_p_matrix vnl_matrix_fixed< T, 3, 4 > const &  P  )  [explicit]
 

Construct from 3x4 matrix.

Definition at line 46 of file vgl_p_matrix.txx.

template<class T>
vgl_p_matrix< T >::vgl_p_matrix const vnl_matrix< T > &  A,
const vnl_vector< T > &  a
 

Construct from 3x3 matrix A and vector a. P = [A a].

Definition at line 54 of file vgl_p_matrix.txx.

template<class T>
vgl_p_matrix< T >::vgl_p_matrix const vgl_p_matrix< T > &  P  ) 
 

Definition at line 72 of file vgl_p_matrix.txx.

template<class T>
vgl_p_matrix< T >::~vgl_p_matrix  ) 
 

Definition at line 90 of file vgl_p_matrix.txx.


Member Function Documentation

template<class T>
vgl_homg_plane_3d< T > vgl_p_matrix< T >::backproject vgl_homg_line_2d< T > const &  l  )  const
 

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

Definition at line 137 of file vgl_p_matrix.txx.

template<class T>
vgl_homg_line_3d_2_points< T > vgl_p_matrix< T >::backproject vgl_homg_point_2d< T > const &  x  )  const
 

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

Uses svd().

Definition at line 129 of file vgl_p_matrix.txx.

template<class T>
vgl_homg_point_3d< T > vgl_p_matrix< T >::backproject_pseudoinverse vgl_homg_point_2d< T > const &  x  )  const
 

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 119 of file vgl_p_matrix.txx.

template<class T>
void vgl_p_matrix< T >::clear_svd  )  const
 

Discredit the cached svd.

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

Definition at line 213 of file vgl_p_matrix.txx.

template<class T>
void vgl_p_matrix< T >::fix_cheirality  ) 
 

Scale P so determinant of first 3x3 is 1.

Definition at line 469 of file vgl_p_matrix.txx.

template<class T>
void vgl_p_matrix< T >::flip_sign  ) 
 

Change the overall sign of the P matrix.

Definition at line 503 of file vgl_p_matrix.txx.

template<class T>
void vgl_p_matrix< T >::get vnl_matrix_fixed< T, 3, 4 > &  p_matrix  )  const [inline]
 

Return the 3x4 projection matrix in p_matrix.

Definition at line 164 of file vgl_p_matrix.h.

template<class T>
void vgl_p_matrix< T >::get vnl_matrix< T > &  p_matrix  )  const [inline]
 

Return the 3x4 projection matrix in p_matrix.

Definition at line 162 of file vgl_p_matrix.h.

template<class T>
void vgl_p_matrix< T >::get T *  c_matrix  )  const
 

Return the 3x4 projection matrix in the C-array, c_matrix.

Definition at line 276 of file vgl_p_matrix.txx.

template<class T>
T vgl_p_matrix< T >::get unsigned int  row_index,
unsigned int  col_index
const
 

Return the element of the matrix at the specified index pair.

Definition at line 268 of file vgl_p_matrix.txx.

template<class T>
void vgl_p_matrix< T >::get vnl_matrix_fixed< T, 3, 3 > *  A,
vnl_vector_fixed< T, 3 > *  a
const
 

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

Definition at line 310 of file vgl_p_matrix.txx.

template<class T>
void vgl_p_matrix< T >::get vnl_matrix< T > *  A,
vnl_vector< T > *  a
const
 

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

Definition at line 287 of file vgl_p_matrix.txx.

template<class T>
vgl_h_matrix_3d< T > vgl_p_matrix< T >::get_canonical_H  )  const
 

Return the 3D H-matrix s.t. P * H = [I 0].

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

Definition at line 236 of file vgl_p_matrix.txx.

template<class T>
vgl_homg_point_3d< T > vgl_p_matrix< T >::get_focal  )  const
 

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

Uses svd().

Definition at line 221 of file vgl_p_matrix.txx.

template<class T>
const vnl_matrix_fixed<T, 3, 4>& vgl_p_matrix< T >::get_matrix  )  const [inline]
 

Definition at line 177 of file vgl_p_matrix.h.

template<class T>
void vgl_p_matrix< T >::get_rows vnl_vector_fixed< T, 4 > *  a,
vnl_vector_fixed< T, 4 > *  b,
vnl_vector_fixed< T, 4 > *  c
const
 

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

Definition at line 355 of file vgl_p_matrix.txx.

template<class T>
void vgl_p_matrix< T >::get_rows vnl_vector< T > *  a,
vnl_vector< T > *  b,
vnl_vector< T > *  c
const
 

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

Definition at line 333 of file vgl_p_matrix.txx.

template<class T>
bool vgl_p_matrix< T >::is_behind_camera vgl_homg_point_3d< T > const &   ) 
 

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 493 of file vgl_p_matrix.txx.

template<class T>
bool vgl_p_matrix< T >::is_canonical tol = 0  )  const
 

Return true iff P is [I 0].

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

Definition at line 245 of file vgl_p_matrix.txx.

template<class T>
bool vgl_p_matrix< T >::looks_conditioned  ) 
 

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

Definition at line 511 of file vgl_p_matrix.txx.

template<class T>
vgl_p_matrix<T> vgl_p_matrix< T >::operator * vnl_matrix_fixed< T, 3, 3 > const &  C  )  const [inline]
 

pre-multiply this projection matrix with a 2-d projective transform.

Definition at line 109 of file vgl_p_matrix.h.

template<class T>
vgl_line_segment_2d<T> vgl_p_matrix< T >::operator * vgl_line_segment_3d< T > const &  L  )  const [inline]
 

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

Definition at line 91 of file vgl_p_matrix.h.

template<class T>
vgl_homg_line_2d<T> vgl_p_matrix< T >::operator * vgl_homg_line_3d_2_points< T > const &  L  )  const [inline]
 

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

Definition at line 87 of file vgl_p_matrix.h.

template<class T>
vgl_homg_point_2d<T> vgl_p_matrix< T >::operator * vgl_homg_point_3d< T > const &  X  )  const [inline]
 

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

Definition at line 83 of file vgl_p_matrix.h.

template<class T>
vgl_line_segment_2d< T > vgl_p_matrix< T >::operator() vgl_line_segment_3d< T > const &  L  )  const
 

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

Definition at line 109 of file vgl_p_matrix.txx.

template<class T>
vgl_homg_line_2d< T > vgl_p_matrix< T >::operator() vgl_homg_line_3d_2_points< T > const &  L  )  const
 

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

Definition at line 101 of file vgl_p_matrix.txx.

template<class T>
vgl_homg_point_2d<T> vgl_p_matrix< T >::operator() vgl_homg_point_3d< T > const &  X  )  const [inline]
 

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

Definition at line 81 of file vgl_p_matrix.h.

template<class T>
vgl_p_matrix< T > & vgl_p_matrix< T >::operator= const vgl_p_matrix< T > &   ) 
 

Definition at line 79 of file vgl_p_matrix.txx.

template<class T>
bool vgl_p_matrix< T >::operator== vgl_p_matrix< T > const &  p  )  const [inline]
 

Definition at line 143 of file vgl_p_matrix.h.

template<class T>
vgl_p_matrix< T > vgl_p_matrix< T >::postmultiply vnl_matrix_fixed< T, 4, 4 > const &  H  )  const
 

post-multiply this projection matrix with a 3-d projective transform.

Definition at line 521 of file vgl_p_matrix.txx.

template<class T>
vgl_p_matrix< T > vgl_p_matrix< T >::premultiply vnl_matrix_fixed< T, 3, 3 > const &  H  )  const
 

pre-multiply this projection matrix with a 2-d projective transform.

Definition at line 527 of file vgl_p_matrix.txx.

template<class T>
vgl_p_matrix< T > vgl_p_matrix< T >::read vcl_istream &   )  [static]
 

Load from vcl_istream.

Definition at line 191 of file vgl_p_matrix.txx.

template<class T>
vgl_p_matrix< T > vgl_p_matrix< T >::read const char *  filename  )  [static]
 

Load from file.

Static method, so you can say

Definition at line 175 of file vgl_p_matrix.txx.

template<class T>
bool vgl_p_matrix< T >::read_ascii vcl_istream &  f  ) 
 

Load from file.

 P.read_ascii("file.P");

Definition at line 160 of file vgl_p_matrix.txx.

template<class T>
void vgl_p_matrix< T >::set const vnl_matrix< T > &  A,
const vnl_vector< T > &  a
 

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

Definition at line 426 of file vgl_p_matrix.txx.

template<class T>
void vgl_p_matrix< T >::set vnl_matrix_fixed< T, 3, 4 > const &  p_matrix  )  [inline]
 

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

Definition at line 173 of file vgl_p_matrix.h.

template<class T>
void vgl_p_matrix< T >::set const vnl_matrix< T > &  p_matrix  )  [inline]
 

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

Definition at line 171 of file vgl_p_matrix.h.

template<class T>
void vgl_p_matrix< T >::set const T  p_matrix[3][4]  ) 
 

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

Definition at line 401 of file vgl_p_matrix.txx.

template<class T>
void vgl_p_matrix< T >::set const T *  p_matrix  ) 
 

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

Definition at line 413 of file vgl_p_matrix.txx.

template<class T>
void vgl_p_matrix< T >::set_identity  ) 
 

Set the camera to an identity projection. X->u, Y->v.

Definition at line 448 of file vgl_p_matrix.txx.

template<class T>
void vgl_p_matrix< T >::set_rows const vnl_vector< T > &  a,
const vnl_vector< T > &  b,
const vnl_vector< T > &  c
 

Set P = [a b c]' from its rows a, b, c.

Definition at line 379 of file vgl_p_matrix.txx.

template<class T>
vnl_svd< T > * vgl_p_matrix< T >::svd  )  const
 

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

Definition at line 203 of file vgl_p_matrix.txx.


Member Data Documentation

template<class T>
vnl_matrix_fixed<T, 3,4> vgl_p_matrix< T >::p_matrix_ [protected]
 

Definition at line 192 of file vgl_p_matrix.h.

template<class T>
vnl_svd<T>* vgl_p_matrix< T >::svd_ [mutable, protected]
 

Definition at line 193 of file vgl_p_matrix.h.


The documentation for this class was generated from the following files:
Generated on Thu Jan 10 14:39:28 2008 for core/vgl by  doxygen 1.4.4