contrib/oxl/mvl/AffineMetric.h
Go to the documentation of this file.
00001 // This is oxl/mvl/AffineMetric.h
00002 #ifndef AffineMetric_h_
00003 #define AffineMetric_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief AffineMetric is an ImageMetric that is an affine transformation.
00010 // \author
00011 //     Andrew W. Fitzgibbon, Oxford RRG, 24 Feb 97
00012 //
00013 // \verbatim
00014 //  Modifications
00015 //   22 Jun 2003 - Peter Vanroose - added vgl_homg_point_2d interface
00016 // \endverbatim
00017 //
00018 //-----------------------------------------------------------------------------
00019 
00020 #include <vnl/vnl_double_3x3.h>
00021 #include <vgl/vgl_fwd.h>
00022 #include <mvl/ImageMetric.h>
00023 #include <vcl_iosfwd.h>
00024 
00025 class AffineMetric : public ImageMetric
00026 {
00027   vnl_double_3x3 A_;
00028   vnl_double_3x3 A_inverse_;
00029  public:
00030 
00031   AffineMetric();
00032   AffineMetric(vnl_double_3x3 const& A);
00033 
00034   virtual vgl_point_2d<double> homg_to_image(vgl_homg_point_2d<double> const&) const;
00035   virtual vnl_double_2 homg_to_image(const HomgPoint2D& p) const;
00036 
00037   virtual vgl_homg_point_2d<double> image_to_homg(vgl_point_2d<double> const&) const;
00038   virtual HomgPoint2D image_to_homg(const vnl_double_2&) const;
00039   virtual HomgPoint2D image_to_homg(double x, double y) const;
00040 
00041   virtual vgl_homg_point_2d<double> homg_to_imagehomg(vgl_homg_point_2d<double> const&) const;
00042   virtual vgl_homg_point_2d<double> imagehomg_to_homg(vgl_homg_point_2d<double> const&) const;
00043 
00044   virtual HomgPoint2D homg_to_imagehomg(const HomgPoint2D& p) const;
00045   virtual HomgPoint2D imagehomg_to_homg(const HomgPoint2D& p) const;
00046 
00047   void set(vnl_double_3x3 const& A);
00048   void set(vnl_matrix<double> const& A);
00049 
00050   void set(double a11, double a13, double a22, double a23, double a33);
00051 
00052   //: Return forward transformation matrix
00053   virtual vnl_double_3x3 get_C() const { return A_; }
00054 
00055   //: Return inverse transformation matrix
00056   virtual vnl_double_3x3 get_C_inverse() const { return A_inverse_; }
00057 
00058   //: Declare that this is a linear transformation
00059   virtual bool is_linear() const { return true; }
00060 
00061   //: Declare that this is not an isometry
00062   virtual bool can_invert_distance() const { return false; }
00063 
00064   //: Send a human-readable representation to ostream
00065   vcl_ostream& print(vcl_ostream& s) const;
00066 };
00067 
00068 #endif // AffineMetric_h_