Public Member Functions | Protected Attributes
vgl_h_matrix_3d< T > Class Template Reference

A class to hold a 3-d projective transformation matrix and to perform common operations using it e.g. More...

#include <vgl_h_matrix_3d.h>

Inheritance diagram for vgl_h_matrix_3d< T >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 vgl_h_matrix_3d ()
 ~vgl_h_matrix_3d ()
 vgl_h_matrix_3d (vgl_h_matrix_3d< T > const &M)
 Copy constructor.
 vgl_h_matrix_3d (vnl_matrix_fixed< T, 4, 4 > const &M)
 Constructor from a 4x4 matrix, and implicit cast from vnl_matrix_fixed<T,4,4>.
 vgl_h_matrix_3d (vnl_matrix_fixed< T, 3, 3 > const &M, vnl_vector_fixed< T, 3 > const &m)
 Construct an affine vgl_h_matrix_3d from 3x3 M and 3x1 m.
 vgl_h_matrix_3d (T const *M)
 Constructor from 4x4 row-storage C-array.
 vgl_h_matrix_3d (vcl_istream &s)
 Load from ASCII vcl_istream.
 vgl_h_matrix_3d (char const *filename)
 Load from file.
 vgl_h_matrix_3d (vcl_vector< vgl_homg_point_3d< T > > const &points1, vcl_vector< vgl_homg_point_3d< T > > const &points2)
 Constructor - calculate homography between two sets of 3D points (minimum 5).
vgl_homg_point_3d< T > operator() (vgl_homg_point_3d< T > const &p) const
 Return the transformed point given by $q = { H} p$.
vgl_homg_point_3d< T > operator* (vgl_homg_point_3d< T > const &p) const
 Return the transformed point given by $q = { H} p$.
bool operator== (vgl_h_matrix_3d< T > const &M) const
vgl_homg_plane_3d< T > preimage (vgl_homg_plane_3d< T > const &l) const
 Return the preimage of a transformed plane: $m = { H} l$.
vgl_homg_plane_3d< T > correlation (vgl_homg_point_3d< T > const &p) const
vgl_homg_point_3d< T > correlation (vgl_homg_plane_3d< T > const &l) const
vgl_homg_point_3d< T > preimage (vgl_homg_point_3d< T > const &q) const
 Return the preimage of a transformed point: $p = { H}^{-1} q$.
vgl_homg_plane_3d< T > operator() (vgl_homg_plane_3d< T > const &l) const
 Return the transformed plane given by $m = { H}^{-1} l$.
vgl_homg_plane_3d< T > operator* (vgl_homg_plane_3d< T > const &l) const
 Return the transformed plane given by $m = { H}^{-1} l$.
vgl_h_matrix_3d< T > operator* (vgl_h_matrix_3d< T > const &H) const
 composition (*this) * H.
vnl_matrix_fixed< T, 4, 4 > const & get_matrix () const
 Return the 4x4 homography matrix.
void get (vnl_matrix_fixed< T, 4, 4 > *M) const
 Fill M with contents of the 4x4 homography matrix.
void get (vnl_matrix< T > *M) const
void get (T *M) const
 Fill M with contents of the 4x4 homography matrix.
get (unsigned int row_index, unsigned int col_index) const
 Return an element from the 4x4 homography matrix.
vgl_h_matrix_3d get_inverse () const
 Return the inverse homography.
vgl_h_matrix_3dset (unsigned int row_index, unsigned int col_index, T value)
 Set an element of the 4x4 homography matrix.
vgl_h_matrix_3dset (T const *M)
 Set to 4x4 row-stored matrix.
vgl_h_matrix_3dset (vnl_matrix_fixed< T, 4, 4 > const &M)
 Set to given 4x4 matrix.
vgl_h_matrix_3dset_identity ()
 initialize the transformation to identity.
vgl_h_matrix_3dset_translation (T tx, T ty, T tz)
 set H[0][3] = tx, H[1][3] = ty, and H[2][3] = tz, other elements unaltered.
vgl_h_matrix_3dset_scale (T scale)
 compose the current transform with a uniform scaling transformation, S.
vgl_h_matrix_3dset_affine (vnl_matrix_fixed< T, 3, 4 > const &M34)
 set the transform to a general affine transform matrix.
vgl_h_matrix_3dset_rotation_matrix (vnl_matrix_fixed< T, 3, 3 > const &R)
 Just the upper 3x3 part of the matrix is replaced by a rotation matrix.
vgl_h_matrix_3dset_rotation_about_axis (vnl_vector_fixed< T, 3 > const &axis, T theta)
 Set to rotation about an axis.
vgl_h_matrix_3dset_rotation_roll_pitch_yaw (T yaw, T pitch, T roll)
 Set to roll, pitch and yaw specified rotation.
vgl_h_matrix_3dset_rotation_euler (T rz1, T ry, T rz2)
 Set to rotation specified by Euler angles.
void set_reflection_plane (vgl_plane_3d< double > const &p)
 set the transformation to a reflection about a plane.
bool is_rotation () const
bool is_identity () const
bool is_euclidean () const
bool projective_basis (vcl_vector< vgl_homg_point_3d< T > > const &five_points)
 Compute transform to projective basis given five points, no 4 of which coplanar.
bool projective_basis (vcl_vector< vgl_homg_plane_3d< T > > const &five_planes)
 transformation to projective basis (canonical frame).
vgl_h_matrix_3d< T > get_upper_3x3 () const
 corresponds to rotation for Euclidean transformations.
vnl_matrix_fixed< T, 3, 3 > get_upper_3x3_matrix () const
vgl_homg_point_3d< T > get_translation () const
 corresponds to translation for affine transformations.
vnl_vector_fixed< T, 3 > get_translation_vector () const
bool read (vcl_istream &s)
 Load H from ASCII file.
bool read (char const *filename)
 Read H from file.

Protected Attributes

vnl_matrix_fixed< T, 4, 4 > t12_matrix_

Detailed Description

template<class T>
class vgl_h_matrix_3d< T >

A class to hold a 3-d projective transformation matrix and to perform common operations using it e.g.

transform point.

Definition at line 33 of file vgl_h_matrix_3d.h.


Constructor & Destructor Documentation

template<class T>
vgl_h_matrix_3d< T >::vgl_h_matrix_3d ( ) [inline]

Definition at line 38 of file vgl_h_matrix_3d.h.

template<class T>
vgl_h_matrix_3d< T >::~vgl_h_matrix_3d ( ) [inline]

Definition at line 39 of file vgl_h_matrix_3d.h.

template<class T>
vgl_h_matrix_3d< T >::vgl_h_matrix_3d ( vgl_h_matrix_3d< T > const &  M) [inline]

Copy constructor.

Definition at line 41 of file vgl_h_matrix_3d.h.

template<class T>
vgl_h_matrix_3d< T >::vgl_h_matrix_3d ( vnl_matrix_fixed< T, 4, 4 > const &  M) [inline]

Constructor from a 4x4 matrix, and implicit cast from vnl_matrix_fixed<T,4,4>.

Definition at line 43 of file vgl_h_matrix_3d.h.

template<class T >
vgl_h_matrix_3d< T >::vgl_h_matrix_3d ( vnl_matrix_fixed< T, 3, 3 > const &  M,
vnl_vector_fixed< T, 3 > const &  m 
)

Construct an affine vgl_h_matrix_3d from 3x3 M and 3x1 m.

Definition at line 77 of file vgl_h_matrix_3d.txx.

template<class T>
vgl_h_matrix_3d< T >::vgl_h_matrix_3d ( T const *  M) [inline, explicit]

Constructor from 4x4 row-storage C-array.

Definition at line 48 of file vgl_h_matrix_3d.h.

template<class T >
vgl_h_matrix_3d< T >::vgl_h_matrix_3d ( vcl_istream &  s) [explicit]

Load from ASCII vcl_istream.

Definition at line 61 of file vgl_h_matrix_3d.txx.

template<class T >
vgl_h_matrix_3d< T >::vgl_h_matrix_3d ( char const *  filename) [explicit]

Load from file.

Definition at line 67 of file vgl_h_matrix_3d.txx.

template<class T >
vgl_h_matrix_3d< T >::vgl_h_matrix_3d ( vcl_vector< vgl_homg_point_3d< T > > const &  points1,
vcl_vector< vgl_homg_point_3d< T > > const &  points2 
)

Constructor - calculate homography between two sets of 3D points (minimum 5).

Definition at line 21 of file vgl_h_matrix_3d.txx.


Member Function Documentation

template<class T >
vgl_homg_plane_3d< T > vgl_h_matrix_3d< T >::correlation ( vgl_homg_point_3d< T > const &  p) const

Definition at line 104 of file vgl_h_matrix_3d.txx.

template<class T >
vgl_homg_point_3d< T > vgl_h_matrix_3d< T >::correlation ( vgl_homg_plane_3d< T > const &  l) const

Definition at line 120 of file vgl_h_matrix_3d.txx.

template<class T >
void vgl_h_matrix_3d< T >::get ( vnl_matrix_fixed< T, 4, 4 > *  M) const

Fill M with contents of the 4x4 homography matrix.

Definition at line 180 of file vgl_h_matrix_3d.txx.

template<class T >
void vgl_h_matrix_3d< T >::get ( vnl_matrix< T > *  M) const
Deprecated:
use the vnl_matrix_fixed variant instead

Definition at line 186 of file vgl_h_matrix_3d.txx.

template<class T >
void vgl_h_matrix_3d< T >::get ( T *  M) const

Fill M with contents of the 4x4 homography matrix.

Definition at line 173 of file vgl_h_matrix_3d.txx.

template<class T >
T vgl_h_matrix_3d< T >::get ( unsigned int  row_index,
unsigned int  col_index 
) const

Return an element from the 4x4 homography matrix.

Definition at line 167 of file vgl_h_matrix_3d.txx.

template<class T >
vgl_h_matrix_3d< T > vgl_h_matrix_3d< T >::get_inverse ( ) const

Return the inverse homography.

Definition at line 194 of file vgl_h_matrix_3d.txx.

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

Return the 4x4 homography matrix.

Definition at line 90 of file vgl_h_matrix_3d.h.

template<class T >
vgl_homg_point_3d< T > vgl_h_matrix_3d< T >::get_translation ( ) const

corresponds to translation for affine transformations.

Definition at line 420 of file vgl_h_matrix_3d.txx.

template<class T >
vnl_vector_fixed< T, 3 > vgl_h_matrix_3d< T >::get_translation_vector ( ) const

Definition at line 433 of file vgl_h_matrix_3d.txx.

template<class T >
vgl_h_matrix_3d< T > vgl_h_matrix_3d< T >::get_upper_3x3 ( ) const

corresponds to rotation for Euclidean transformations.

Definition at line 393 of file vgl_h_matrix_3d.txx.

template<class T >
vnl_matrix_fixed< T, 3, 3 > vgl_h_matrix_3d< T >::get_upper_3x3_matrix ( ) const

Definition at line 408 of file vgl_h_matrix_3d.txx.

template<class T >
bool vgl_h_matrix_3d< T >::is_euclidean ( ) const

Definition at line 367 of file vgl_h_matrix_3d.txx.

template<class T >
bool vgl_h_matrix_3d< T >::is_identity ( ) const

Definition at line 385 of file vgl_h_matrix_3d.txx.

template<class T >
bool vgl_h_matrix_3d< T >::is_rotation ( ) const

Definition at line 357 of file vgl_h_matrix_3d.txx.

template<class T >
vgl_homg_point_3d< T > vgl_h_matrix_3d< T >::operator() ( vgl_homg_point_3d< T > const &  p) const

Return the transformed point given by $q = { H} p$.

Definition at line 96 of file vgl_h_matrix_3d.txx.

template<class T >
vgl_homg_plane_3d< T > vgl_h_matrix_3d< T >::operator() ( vgl_homg_plane_3d< T > const &  l) const

Return the transformed plane given by $m = { H}^{-1} l$.

(requires an inverse)

Definition at line 136 of file vgl_h_matrix_3d.txx.

template<class T>
vgl_homg_point_3d<T> vgl_h_matrix_3d< T >::operator* ( vgl_homg_point_3d< T > const &  p) const [inline]

Return the transformed point given by $q = { H} p$.

Definition at line 62 of file vgl_h_matrix_3d.h.

template<class T>
vgl_homg_plane_3d<T> vgl_h_matrix_3d< T >::operator* ( vgl_homg_plane_3d< T > const &  l) const [inline]

Return the transformed plane given by $m = { H}^{-1} l$.

(requires an inverse)

Definition at line 81 of file vgl_h_matrix_3d.h.

template<class T>
vgl_h_matrix_3d<T> vgl_h_matrix_3d< T >::operator* ( vgl_h_matrix_3d< T > const &  H) const [inline]

composition (*this) * H.

Definition at line 84 of file vgl_h_matrix_3d.h.

template<class T>
bool vgl_h_matrix_3d< T >::operator== ( vgl_h_matrix_3d< T > const &  M) const [inline]

Definition at line 64 of file vgl_h_matrix_3d.h.

template<class T >
vgl_homg_plane_3d< T > vgl_h_matrix_3d< T >::preimage ( vgl_homg_plane_3d< T > const &  l) const

Return the preimage of a transformed plane: $m = { H} l$.

Definition at line 112 of file vgl_h_matrix_3d.txx.

template<class T >
vgl_homg_point_3d< T > vgl_h_matrix_3d< T >::preimage ( vgl_homg_point_3d< T > const &  q) const

Return the preimage of a transformed point: $p = { H}^{-1} q$.

(requires an inverse)

Definition at line 128 of file vgl_h_matrix_3d.txx.

template<class T >
bool vgl_h_matrix_3d< T >::projective_basis ( vcl_vector< vgl_homg_point_3d< T > > const &  five_points)

Compute transform to projective basis given five points, no 4 of which coplanar.

Transformation to projective basis (canonical frame) Compute the homography that takes the input set of points to the canonical frame. The points act as the projective basis for the canonical coordinate system. In the canonical frame the points have coordinates: ${array}{cccc} p[0] & p[1] & p[2] & p[3] & p[4] \% 1 & 0 & 0 & 0 & 1 \% 0 & 1 & 0 & 0 & 1 \% 0 & 0 & 1 & 0 & 1 \% 0 & 0 & 0 & 1 & 1 {array}$

Definition at line 217 of file vgl_h_matrix_3d.txx.

template<class T >
bool vgl_h_matrix_3d< T >::projective_basis ( vcl_vector< vgl_homg_plane_3d< T > > const &  five_planes)

transformation to projective basis (canonical frame).

Compute the homography that takes the input set of planes to the canonical frame. The planes act as the dual projective basis for the canonical coordinate system. In the canonical frame the planes have equations: x=0; y=0; z=0; w=0; x+y+z+w=0. (The latter plane is the plane at infinity.)

Definition at line 224 of file vgl_h_matrix_3d.txx.

template<class T >
bool vgl_h_matrix_3d< T >::read ( vcl_istream &  s)

Load H from ASCII file.

Definition at line 149 of file vgl_h_matrix_3d.txx.

template<class T >
bool vgl_h_matrix_3d< T >::read ( char const *  filename)

Read H from file.

Definition at line 156 of file vgl_h_matrix_3d.txx.

template<class T>
vgl_h_matrix_3d& vgl_h_matrix_3d< T >::set ( unsigned int  row_index,
unsigned int  col_index,
value 
) [inline]

Set an element of the 4x4 homography matrix.

Definition at line 104 of file vgl_h_matrix_3d.h.

template<class T >
vgl_h_matrix_3d< T > & vgl_h_matrix_3d< T >::set ( T const *  M)

Set to 4x4 row-stored matrix.

Definition at line 201 of file vgl_h_matrix_3d.txx.

template<class T >
vgl_h_matrix_3d< T > & vgl_h_matrix_3d< T >::set ( vnl_matrix_fixed< T, 4, 4 > const &  M)

Set to given 4x4 matrix.

Definition at line 210 of file vgl_h_matrix_3d.txx.

template<class T >
vgl_h_matrix_3d< T > & vgl_h_matrix_3d< T >::set_affine ( vnl_matrix_fixed< T, 3, 4 > const &  M34)

set the transform to a general affine transform matrix.

$A = [ {array}{ccc} a00 & a01 & a02 & a03 \% a10 & a11 & a12 & a13 \% a20 & a21 & a22 & a23 \% 0 & 0 & 0 & 1 {array}]$

Definition at line 260 of file vgl_h_matrix_3d.txx.

template<class T >
vgl_h_matrix_3d< T > & vgl_h_matrix_3d< T >::set_identity ( )

initialize the transformation to identity.

Definition at line 232 of file vgl_h_matrix_3d.txx.

template<class T >
void vgl_h_matrix_3d< T >::set_reflection_plane ( vgl_plane_3d< double > const &  p)

set the transformation to a reflection about a plane.

Definition at line 336 of file vgl_h_matrix_3d.txx.

template<class T >
vgl_h_matrix_3d< T > & vgl_h_matrix_3d< T >::set_rotation_about_axis ( vnl_vector_fixed< T, 3 > const &  axis,
theta 
)

Set to rotation about an axis.

Just the upper 3x3 part of the matrix is replaced by a rotation matrix. rotation angle theta is in radians

Definition at line 271 of file vgl_h_matrix_3d.txx.

template<class T >
vgl_h_matrix_3d< T > & vgl_h_matrix_3d< T >::set_rotation_euler ( rz1,
ry,
rz2 
)

Set to rotation specified by Euler angles.

Just the upper 3x3 part of the matrix is replaced by a rotation matrix.

Definition at line 305 of file vgl_h_matrix_3d.txx.

template<class T >
vgl_h_matrix_3d< T > & vgl_h_matrix_3d< T >::set_rotation_matrix ( vnl_matrix_fixed< T, 3, 3 > const &  R)

Just the upper 3x3 part of the matrix is replaced by a rotation matrix.

Definition at line 325 of file vgl_h_matrix_3d.txx.

template<class T >
vgl_h_matrix_3d< T > & vgl_h_matrix_3d< T >::set_rotation_roll_pitch_yaw ( yaw,
pitch,
roll 
)

Set to roll, pitch and yaw specified rotation.

  • roll is rotation about z
  • pitch is rotation about y
  • yaw is rotation about x Just the upper 3x3 part of the matrix is replaced by a rotation matrix.

Definition at line 285 of file vgl_h_matrix_3d.txx.

template<class T >
vgl_h_matrix_3d< T > & vgl_h_matrix_3d< T >::set_scale ( scale)

compose the current transform with a uniform scaling transformation, S.

$S = [ {array}{cccc} s & 0 & 0 & 0 \% 0 & s & 0 & 0 \% 0 & 0 & s & 0 \% 0 & 0 & 0 & 1 {array}]$ , Ts = S*T.

Definition at line 250 of file vgl_h_matrix_3d.txx.

template<class T >
vgl_h_matrix_3d< T > & vgl_h_matrix_3d< T >::set_translation ( tx,
ty,
tz 
)

set H[0][3] = tx, H[1][3] = ty, and H[2][3] = tz, other elements unaltered.

Definition at line 240 of file vgl_h_matrix_3d.txx.


Member Data Documentation

template<class T>
vnl_matrix_fixed<T,4,4> vgl_h_matrix_3d< T >::t12_matrix_ [protected]

Definition at line 36 of file vgl_h_matrix_3d.h.


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