2 #ifndef vgl_h_matrix_2d_h_ 3 #define vgl_h_matrix_2d_h_ 25 #include <vnl/vnl_fwd.h> 26 #include <vnl/vnl_matrix_fixed.h> 31 # include <vcl_msvc_warnings.h> 56 vnl_vector_fixed<T,2>
const& m);
104 void get(vnl_matrix_fixed<T,3,3>* M)
const;
107 void get(vnl_matrix<T>* M)
const;
109 void get(T *M)
const;
111 T
get(
unsigned int row_index,
unsigned int col_index)
const;
117 {
t12_matrix_[row_index][col_index]=value;
return *
this; }
210 bool read(std::istream& s);
212 bool read(
char const* filename);
219 { H.
read(s);
return s; }
221 #define VGL_H_MATRIX_2D_INSTANTIATE(T) extern "please include vgl/algo/vgl_h_matrix_2d.hxx first" 223 #endif // vgl_h_matrix_2d_h_
A class to hold a plane-to-plane projective transformation matrix and to perform common operations us...
vnl_matrix_fixed< T, 3, 3 > const & get_matrix() const
Return the 3x3 homography matrix.
bool read(std::istream &s)
Read H from std::istream.
bool operator==(vgl_h_matrix_2d< T > const &M) const
Represents a homogeneous 2D line.
vgl_h_matrix_2d(vgl_h_matrix_2d< T > const &M)
Copy constructor.
vgl_h_matrix_2d & set_aspect_ratio(T aspect_ratio)
compose the transform with diagonal aspect ratio transform.
vgl_h_matrix_2d< T > get_upper_2x2() const
corresponds to rotation for Euclidean transformations.
vgl_homg_point_2d< T > operator *(vgl_homg_point_2d< T > const &p) const
Return the transformed point given by $q = {\tt H} p$.
vgl_h_matrix_2d & set_affine(vnl_matrix_fixed< T, 2, 3 > const &M23)
set the transform to a general affine transform matrix.
vgl_h_matrix_2d & set(unsigned int row_index, unsigned int col_index, T value)
Set an element of the 3x3 homography matrix.
vnl_matrix_fixed< T, 3, 3 > t12_matrix_
vgl_h_matrix_2d & set_rotation(T theta)
the upper 2x2 part of the matrix is replaced by a rotation matrix.
bool is_euclidean() const
std::ostream & operator<<(std::ostream &s, vgl_orient_box_3d< Type > const &p)
Write box to stream.
line in projective 2D space
vgl_homg_point_2d< T > operator()(vgl_homg_point_2d< T > const &p) const
Return the transformed point given by $q = {\tt H} p$.
vnl_matrix_fixed< T, 2, 2 > get_upper_2x2_matrix() const
corresponds to rotation for Euclidean transformations.
vgl_h_matrix_2d & set_similarity(T s, T theta, T tx, T ty)
set the transform to a similarity mapping.
point in projective 2D space
vgl_homg_line_2d< T > preimage(vgl_homg_line_2d< T > const &l) const
Return the transformed line given by $m = {\tt H} l$.
vnl_vector_fixed< T, 2 > get_translation_vector() const
corresponds to translation for affine transformations.
void get(vnl_matrix_fixed< T, 3, 3 > *M) const
Fill M with contents of the 3x3 homography matrix.
std::istream & operator>>(std::istream &is, vgl_orient_box_3d< Type > &p)
Read box from stream.
vgl_homg_line_2d< T > correlation(vgl_homg_point_2d< T > const &p) const
~vgl_h_matrix_2d()=default
vgl_h_matrix_2d & set_translation(T tx, T ty)
set H[0][2] = tx and H[1][2] = ty, other elements unaltered.
vgl_homg_point_2d< T > get_translation() const
corresponds to translation for affine transformations.
vgl_h_matrix_2d get_inverse() const
Return the inverse homography.
vgl_h_matrix_2d & set_scale(T scale)
compose the current transform with a uniform scaling transformation, S.
vgl_h_matrix_2d(T const *M)
Constructor from 3x3 C-array.
vgl_h_matrix_2d()=default
Represents a homogeneous 2D point.
bool projective_basis(std::vector< vgl_homg_point_2d< T > > const &four_points)
transformation to projective basis (canonical frame).
vgl_h_matrix_2d & set_identity()
initialize the transformation to identity.
vgl_h_matrix_2d(vnl_matrix_fixed< T, 3, 3 > const &M)
Constructor from a 3x3 matrix, and implicit cast from vnl_matrix_fixed<T,3,3>.