contrib/oxl/mvl/ProjectiveBasis2D.h
Go to the documentation of this file.
00001 // This is oxl/mvl/ProjectiveBasis2D.h
00002 #ifndef ProjectiveBasis2D_h_
00003 #define ProjectiveBasis2D_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 //  \file
00009 // \brief Canonical basis of 4 points
00010 //
00011 //    Compute planar homography that maps 4 points into the canonical projective basis.
00012 //    The returned H is such that
00013 //    \f[ H \begin{array}{cccc}&&& \\ p_1 & p_2 & p_3 & p_4 \\ &&& \end{array} \sim
00014 //    \begin{array}{cccc}1 & 0 & 0 & 1 \cr
00015 //                       0 & 1 & 0 & 1 \cr
00016 //                       0 & 0 & 1 & 1 \end{array}
00017 //    \f]
00018 //
00019 // \author
00020 //     Andrew W. Fitzgibbon, Oxford RRG, 26 Sep 96
00021 //
00022 // \verbatim
00023 //  Modifications:
00024 //     Peter Vanroose - 3 dec 1998 - "collinear_" implemented
00025 // \endverbatim
00026 //
00027 //-----------------------------------------------------------------------------
00028 
00029 #include <mvl/HMatrix2D.h>
00030 #include <vcl_vector.h>
00031 class HomgPoint2D;
00032 
00033 class ProjectiveBasis2D
00034 {
00035  public:
00036   // Constructors/Destructors--------------------------------------------------
00037 
00038   // tm_get_canonical_proj
00039   ProjectiveBasis2D(const HomgPoint2D&, const HomgPoint2D&, const HomgPoint2D&, const HomgPoint2D&);
00040   ProjectiveBasis2D(const vcl_vector<HomgPoint2D>&);
00041   ProjectiveBasis2D(const ProjectiveBasis2D& that);
00042  ~ProjectiveBasis2D();
00043 
00044   ProjectiveBasis2D& operator=(const ProjectiveBasis2D& that);
00045 
00046   // Operations----------------------------------------------------------------
00047 
00048   // Data Access---------------------------------------------------------------
00049 
00050 //: Return the planar homography that maps the points to the canonical frame.
00051   HMatrix2D& get_T() { return T_; }
00052   const vnl_double_3x3& get_T_matrix() const { return T_.get_matrix(); }
00053 
00054 //: Were three of the four given basis points collinear ?
00055   bool collinear() const { return collinear_; }
00056 
00057   // Data Control--------------------------------------------------------------
00058 
00059  protected:
00060   // Computations--------------------------------------------------------------
00061   void compute(const HomgPoint2D&, const HomgPoint2D&, const HomgPoint2D&, const HomgPoint2D&);
00062 
00063   // Data Members--------------------------------------------------------------
00064   HMatrix2D T_;
00065   bool collinear_;
00066 
00067  private:
00068   // Helpers-------------------------------------------------------------------
00069 };
00070 
00071 #endif // ProjectiveBasis2D_h_