contrib/oxl/mvl/PMatrixDec.h
Go to the documentation of this file.
00001 // This is oxl/mvl/PMatrixDec.h
00002 #ifndef PMatrixDec_h_
00003 #define PMatrixDec_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 //
00010 //   The PMatrixDec class is a subclass of PMatrix.
00011 //   It just adds decomposition of the projection matrix, P, into
00012 //   2 matrices: J (3x3) and D (4x4), with intrinsic and extrinsic
00013 //   parameters, respectively, where P=[J O_3]D.
00014 //
00015 //   References:
00016 // \verbatim
00017 //   pp 50 and 52-54, or more widely, CHAPTER 3 in (Faugeras, 1993):
00018 //   @Book{        faugeras:93,
00019 //     author    = {Faugeras, Olivier},
00020 //     title     = {Three-Dimensional Computer Vision: a Geometric Viewpoint},
00021 //     year      = {1993},
00022 //     publisher = mit-press
00023 //   }
00024 // \endverbatim
00025 //
00026 // \author
00027 //   Angeles Lopez (28-Apr-97)
00028 //
00029 // \verbatim
00030 // Modifications:
00031 //   15-May-97, A.Lopez -> Provide access methods for intrinsic
00032 //                         parameters, denoted by AlphaU, AlphaV, U0 & V0.
00033 // \endverbatim
00034 //
00035 //----------------------------------------------------------------------------
00036 
00037 #include <vnl/vnl_matrix.h>
00038 #include <mvl/PMatrix.h>
00039 #include <vcl_iosfwd.h>
00040 
00041 class PMatrixDec : public PMatrix
00042 {
00043   // Data Members------------------------------------------------------------
00044 
00045   // J and D matrices
00046   vnl_matrix<double> j_matrix_;  // 3x3
00047   vnl_matrix<double> d_matrix_;  // 4x4
00048 
00049  public:
00050   // Constructors/Initializers/Destructors----------------------------------
00051   PMatrixDec(const vnl_matrix<double>& p_matrix);
00052   ~PMatrixDec();
00053 
00054   // Data Access------------------------------------------------------------
00055   const vnl_matrix<double>& IntrinsicParameters () { return j_matrix_; }
00056   const vnl_matrix<double>& ExtrinsicParameters () { return d_matrix_; }
00057 
00058   double GetAlphaU() const { return j_matrix_(0,0); }
00059   double GetAlphaV() const { return j_matrix_(1,1); }
00060   double GetU0() const { return j_matrix_(0,2); }
00061   double GetV0() const { return j_matrix_(1,2); }
00062 
00063   // make tests for this class
00064   void Test();
00065 
00066   friend vcl_ostream& operator<<(vcl_ostream& s, const PMatrixDec& P);
00067 
00068   // INTERNALS---------------------------------------------------------------
00069  private:
00070   void Init();
00071 };
00072 
00073 #endif // PMatrixDec_h_