A class to hold a 3-d projective transformation matrix and to perform common operations using it e.g. More...
#include <vgl_algo_fwd.h>

Public Member Functions | |
| vgl_h_matrix_3d ()=default | |
| ~vgl_h_matrix_3d ()=default | |
| vgl_h_matrix_3d (vgl_h_matrix_3d< T > const &M) | |
| Copy constructor. More... | |
| 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>. More... | |
| 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. More... | |
| vgl_h_matrix_3d (T const *M) | |
| Constructor from 4x4 row-storage C-array. More... | |
| vgl_h_matrix_3d (std::istream &s) | |
| Load from ASCII std::istream. More... | |
| vgl_h_matrix_3d (char const *filename) | |
| Load from file. More... | |
| vgl_h_matrix_3d (std::vector< vgl_homg_point_3d< T > > const &points1, std::vector< vgl_homg_point_3d< T > > const &points2) | |
| Constructor - calculate homography between two sets of 3D points (minimum 5). More... | |
| vgl_homg_point_3d< T > | operator() (vgl_homg_point_3d< T > const &p) const |
| Return the transformed point given by $q = {\tt H} p$. More... | |
| vgl_homg_point_3d< T > | operator * (vgl_homg_point_3d< T > const &p) const |
| Return the transformed point given by $q = {\tt H} p$. More... | |
| 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 = {\tt H} l$. More... | |
| 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_point_3d< T > | operator() (vgl_point_3d< T > const &p) const |
| operate directly on Euclidean points for convenience (no ideal points allowed). More... | |
| vgl_point_3d< T > | operator * (vgl_point_3d< T > const &p) const |
| vgl_pointset_3d< T > | operator() (vgl_pointset_3d< T > const &ptset) const |
| vgl_homg_point_3d< T > | preimage (vgl_homg_point_3d< T > const &q) const |
| Return the preimage of a transformed point: $p = {\tt H}^{-1} q$. More... | |
| vgl_pointset_3d< T > | preimage (vgl_pointset_3d< T > const &ptset) const |
| vgl_homg_plane_3d< T > | operator() (vgl_homg_plane_3d< T > const &l) const |
| Return the transformed plane given by $m = {\tt H}^{-1} l$. More... | |
| vgl_homg_plane_3d< T > | operator * (vgl_homg_plane_3d< T > const &l) const |
| Return the transformed plane given by $m = {\tt H}^{-1} l$. More... | |
| vgl_h_matrix_3d< T > | operator * (vgl_h_matrix_3d< T > const &H) const |
| composition (*this) * H. More... | |
| vnl_matrix_fixed< T, 4, 4 > const & | get_matrix () const |
| Return the 4x4 homography matrix. More... | |
| void | get (vnl_matrix_fixed< T, 4, 4 > *M) const |
| Fill M with contents of the 4x4 homography matrix. More... | |
| void | get (vnl_matrix< T > *M) const |
| void | get (T *M) const |
| Fill M with contents of the 4x4 homography matrix. More... | |
| T | get (unsigned int row_index, unsigned int col_index) const |
| Return an element from the 4x4 homography matrix. More... | |
| vgl_h_matrix_3d | get_inverse () const |
| Return the inverse homography. More... | |
| vgl_h_matrix_3d & | set (unsigned int row_index, unsigned int col_index, T value) |
| Set an element of the 4x4 homography matrix. More... | |
| vgl_h_matrix_3d & | set (T const *M) |
| Set to 4x4 row-stored matrix. More... | |
| vgl_h_matrix_3d & | set (vnl_matrix_fixed< T, 4, 4 > const &M) |
| Set to given 4x4 matrix. More... | |
| vgl_h_matrix_3d & | set_identity () |
| initialize the transformation to identity. More... | |
| vgl_h_matrix_3d & | set_translation (T tx, T ty, T tz) |
| set H[0][3] = tx, H[1][3] = ty, and H[2][3] = tz, other elements unaltered. More... | |
| vgl_h_matrix_3d & | set_scale (T scale) |
| compose the current transform with a uniform scaling transformation, S. More... | |
| vgl_h_matrix_3d & | set_affine (vnl_matrix_fixed< T, 3, 4 > const &M34) |
| set the transform to a general affine transform matrix. More... | |
| vgl_h_matrix_3d & | 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. More... | |
| vgl_h_matrix_3d & | set_rotation_about_axis (vnl_vector_fixed< T, 3 > const &axis, T theta) |
| Set to rotation about an axis. More... | |
| vgl_h_matrix_3d & | set_rotation_roll_pitch_yaw (T yaw, T pitch, T roll) |
| Set to roll, pitch and yaw specified rotation. More... | |
| vgl_h_matrix_3d & | set_rotation_euler (T rz1, T ry, T rz2) |
| Set to rotation specified by Euler angles. More... | |
| void | set_reflection_plane (vgl_plane_3d< double > const &p) |
| set the transformation to a reflection about a plane. More... | |
| bool | is_rotation () const |
| bool | is_identity () const |
| bool | is_euclidean () const |
| bool | is_affine () const |
| bool | projective_basis (std::vector< vgl_homg_point_3d< T > > const &five_points) |
| Compute transform to projective basis given five points, no 4 of which coplanar. More... | |
| bool | projective_basis (std::vector< vgl_homg_plane_3d< T > > const &five_planes) |
| transformation to projective basis (canonical frame). More... | |
| vgl_h_matrix_3d< T > | get_upper_3x3 () const |
| corresponds to rotation for Euclidean transformations. More... | |
| 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. More... | |
| vnl_vector_fixed< T, 3 > | get_translation_vector () const |
| void | polar_decomposition (vnl_matrix_fixed< T, 3, 3 > &S, vnl_matrix_fixed< T, 3, 3 > &R) const |
| polar decomposition of the upper 3x3 matrix, M = S*R, where S is a symmetric matrix and R is an orthonormal matrix. More... | |
| bool | read (std::istream &s) |
| Load H from ASCII file. More... | |
| bool | read (char const *filename) |
| Read H from file. More... | |
Protected Attributes | |
| vnl_matrix_fixed< T, 4, 4 > | t12_matrix_ |
A class to hold a 3-d projective transformation matrix and to perform common operations using it e.g.
transform point.
Definition at line 12 of file vgl_algo_fwd.h.
|
default |
|
default |
|
inline |
Copy constructor.
Definition at line 45 of file vgl_h_matrix_3d.h.
|
inline |
Constructor from a 4x4 matrix, and implicit cast from vnl_matrix_fixed<T,4,4>.
Definition at line 47 of file vgl_h_matrix_3d.h.
| 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 81 of file vgl_h_matrix_3d.hxx.
|
inlineexplicit |
Constructor from 4x4 row-storage C-array.
Definition at line 52 of file vgl_h_matrix_3d.h.
|
explicit |
Load from ASCII std::istream.
Definition at line 65 of file vgl_h_matrix_3d.hxx.
|
explicit |
Load from file.
Definition at line 71 of file vgl_h_matrix_3d.hxx.
| vgl_h_matrix_3d< T >::vgl_h_matrix_3d | ( | std::vector< vgl_homg_point_3d< T > > const & | points1, |
| std::vector< vgl_homg_point_3d< T > > const & | points2 | ||
| ) |
Constructor - calculate homography between two sets of 3D points (minimum 5).
Definition at line 25 of file vgl_h_matrix_3d.hxx.
| vgl_homg_plane_3d< T > vgl_h_matrix_3d< T >::correlation | ( | vgl_homg_point_3d< T > const & | p | ) | const |
Definition at line 134 of file vgl_h_matrix_3d.hxx.
| vgl_homg_point_3d< T > vgl_h_matrix_3d< T >::correlation | ( | vgl_homg_plane_3d< T > const & | l | ) | const |
Definition at line 150 of file vgl_h_matrix_3d.hxx.
| 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 215 of file vgl_h_matrix_3d.hxx.
| void vgl_h_matrix_3d< T >::get | ( | vnl_matrix< T > * | M | ) | const |
Definition at line 221 of file vgl_h_matrix_3d.hxx.
| void vgl_h_matrix_3d< T >::get | ( | T * | M | ) | const |
Fill M with contents of the 4x4 homography matrix.
Definition at line 208 of file vgl_h_matrix_3d.hxx.
| 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 202 of file vgl_h_matrix_3d.hxx.
| vgl_h_matrix_3d< T > vgl_h_matrix_3d< T >::get_inverse | ( | ) | const |
Return the inverse homography.
Definition at line 229 of file vgl_h_matrix_3d.hxx.
|
inline |
Return the 4x4 homography matrix.
Definition at line 106 of file vgl_h_matrix_3d.h.
| vgl_homg_point_3d< T > vgl_h_matrix_3d< T >::get_translation | ( | ) | const |
corresponds to translation for affine transformations.
Definition at line 478 of file vgl_h_matrix_3d.hxx.
| vnl_vector_fixed< T, 3 > vgl_h_matrix_3d< T >::get_translation_vector | ( | ) | const |
Definition at line 491 of file vgl_h_matrix_3d.hxx.
| vgl_h_matrix_3d< T > vgl_h_matrix_3d< T >::get_upper_3x3 | ( | ) | const |
corresponds to rotation for Euclidean transformations.
Definition at line 439 of file vgl_h_matrix_3d.hxx.
| vnl_matrix_fixed< T, 3, 3 > vgl_h_matrix_3d< T >::get_upper_3x3_matrix | ( | ) | const |
Definition at line 454 of file vgl_h_matrix_3d.hxx.
| bool vgl_h_matrix_3d< T >::is_affine | ( | ) | const |
Definition at line 421 of file vgl_h_matrix_3d.hxx.
| bool vgl_h_matrix_3d< T >::is_euclidean | ( | ) | const |
Definition at line 402 of file vgl_h_matrix_3d.hxx.
| bool vgl_h_matrix_3d< T >::is_identity | ( | ) | const |
Definition at line 431 of file vgl_h_matrix_3d.hxx.
| bool vgl_h_matrix_3d< T >::is_rotation | ( | ) | const |
Definition at line 392 of file vgl_h_matrix_3d.hxx.
|
inline |
Return the transformed point given by $q = {\tt H} p$.
Definition at line 66 of file vgl_h_matrix_3d.h.
|
inline |
Definition at line 81 of file vgl_h_matrix_3d.h.
|
inline |
Return the transformed plane given by $m = {\tt H}^{-1} l$.
(requires an inverse)
Definition at line 97 of file vgl_h_matrix_3d.h.
|
inline |
composition (*this) * H.
Definition at line 100 of file vgl_h_matrix_3d.h.
| 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 = {\tt H} p$.
Definition at line 100 of file vgl_h_matrix_3d.hxx.
|
inline |
operate directly on Euclidean points for convenience (no ideal points allowed).
Definition at line 78 of file vgl_h_matrix_3d.h.
| vgl_pointset_3d< T > vgl_h_matrix_3d< T >::operator() | ( | vgl_pointset_3d< T > const & | ptset | ) | const |
Definition at line 107 of file vgl_h_matrix_3d.hxx.
| 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 = {\tt H}^{-1} l$.
(requires an inverse)
Definition at line 171 of file vgl_h_matrix_3d.hxx.
|
inline |
Definition at line 68 of file vgl_h_matrix_3d.h.
| void vgl_h_matrix_3d< T >::polar_decomposition | ( | vnl_matrix_fixed< T, 3, 3 > & | S, |
| vnl_matrix_fixed< T, 3, 3 > & | R | ||
| ) | const |
polar decomposition of the upper 3x3 matrix, M = S*R, where S is a symmetric matrix and R is an orthonormal matrix.
useful for interpreting affine transformations
Definition at line 464 of file vgl_h_matrix_3d.hxx.
| 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 = {\tt H} l$.
Definition at line 142 of file vgl_h_matrix_3d.hxx.
| 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 = {\tt H}^{-1} q$.
(requires an inverse)
Definition at line 158 of file vgl_h_matrix_3d.hxx.
| vgl_pointset_3d< T > vgl_h_matrix_3d< T >::preimage | ( | vgl_pointset_3d< T > const & | ptset | ) | const |
Definition at line 164 of file vgl_h_matrix_3d.hxx.
| bool vgl_h_matrix_3d< T >::projective_basis | ( | std::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: $\begin{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 \end{array}$
Definition at line 252 of file vgl_h_matrix_3d.hxx.
| bool vgl_h_matrix_3d< T >::projective_basis | ( | std::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 259 of file vgl_h_matrix_3d.hxx.
| bool vgl_h_matrix_3d< T >::read | ( | std::istream & | s | ) |
Load H from ASCII file.
Definition at line 184 of file vgl_h_matrix_3d.hxx.
| bool vgl_h_matrix_3d< T >::read | ( | char const * | filename | ) |
Read H from file.
Definition at line 191 of file vgl_h_matrix_3d.hxx.
|
inline |
Set an element of the 4x4 homography matrix.
Definition at line 120 of file vgl_h_matrix_3d.h.
| vgl_h_matrix_3d< T > & vgl_h_matrix_3d< T >::set | ( | T const * | M | ) |
Set to 4x4 row-stored matrix.
Definition at line 236 of file vgl_h_matrix_3d.hxx.
| 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 245 of file vgl_h_matrix_3d.hxx.
| 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 = \left[ \begin{array}{ccc} a00 & a01 & a02 & a03 \% a10 & a11 & a12 & a13 \% a20 & a21 & a22 & a23 \% 0 & 0 & 0 & 1 \end{array}\right]$
Definition at line 295 of file vgl_h_matrix_3d.hxx.
| vgl_h_matrix_3d< T > & vgl_h_matrix_3d< T >::set_identity | ( | ) |
initialize the transformation to identity.
Definition at line 267 of file vgl_h_matrix_3d.hxx.
| 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 371 of file vgl_h_matrix_3d.hxx.
| vgl_h_matrix_3d< T > & vgl_h_matrix_3d< T >::set_rotation_about_axis | ( | vnl_vector_fixed< T, 3 > const & | axis, |
| T | 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 306 of file vgl_h_matrix_3d.hxx.
| vgl_h_matrix_3d< T > & vgl_h_matrix_3d< T >::set_rotation_euler | ( | T | rz1, |
| T | ry, | ||
| T | 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 340 of file vgl_h_matrix_3d.hxx.
| 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 360 of file vgl_h_matrix_3d.hxx.
| vgl_h_matrix_3d< T > & vgl_h_matrix_3d< T >::set_rotation_roll_pitch_yaw | ( | T | yaw, |
| T | pitch, | ||
| T | roll | ||
| ) |
Set to roll, pitch and yaw specified rotation.
Definition at line 320 of file vgl_h_matrix_3d.hxx.
| vgl_h_matrix_3d< T > & vgl_h_matrix_3d< T >::set_scale | ( | T | scale | ) |
compose the current transform with a uniform scaling transformation, S.
$S = \left[ \begin{array}{cccc} s & 0 & 0 & 0 \% 0 & s & 0 & 0 \% 0 & 0 & s & 0 \% 0 & 0 & 0 & 1 \end{array}\right]$ , Ts = S*T.
Definition at line 285 of file vgl_h_matrix_3d.hxx.
| vgl_h_matrix_3d< T > & vgl_h_matrix_3d< T >::set_translation | ( | T | tx, |
| T | ty, | ||
| T | tz | ||
| ) |
set H[0][3] = tx, H[1][3] = ty, and H[2][3] = tz, other elements unaltered.
Definition at line 275 of file vgl_h_matrix_3d.hxx.
|
protected |
Definition at line 40 of file vgl_h_matrix_3d.h.
1.8.15