Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EMatrix.hh
1 /*
2 This file is part of the BIAS library (Basic ImageAlgorithmS).
3 
4 Copyright (C) 2003-2009 (see file CONTACT for details)
5  Multimediale Systeme der Informationsverarbeitung
6  Institut fuer Informatik
7  Christian-Albrechts-Universitaet Kiel
8 
9 
10 BIAS is free software; you can redistribute it and/or modify
11 it under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14 
15 BIAS is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU Lesser General Public License for more details.
19 
20 You should have received a copy of the GNU Lesser General Public License
21 along with BIAS; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24 
25 
26 #ifndef __BIAS_EMatrix_hh__
27 #define __BIAS_EMatrix_hh__
28 #include "bias_config.h"
29 
30 
31 #include <Base/Debug/Error.hh>
32 #include <Base/Debug/Debug.hh>
33 #include "FMatrix.hh"
34 #include "RMatrix.hh"
35 #include "Triangulation.hh"
36 
37 #define D_EMATRIX_ROT_TRANS 0x80000000
38 
39 namespace BIAS {
40  template <class T> class Quaternion;
41 
42  /** @class EMatrix
43  @ingroup g_geometry
44  @brief class representing an Essential matrix
45 
46  A essential matrix describes the orientation and position of
47  two image planes with known calibration. It can be used to estimate
48  the epipolarline and to distinguish between mismatches and
49  probably good matchesbecause there are some type of mismatches which
50  are consistent with the epipolar geometry.
51  */
52  class BIASGeometry_EXPORT EMatrix : public FMatrix
53  {
54  public:
55 
56  EMatrix() : FMatrix(){};
57 
59 
60  explicit EMatrix(const MatrixInitType& i): FMatrix(i){};
61 
62  EMatrix(const FMatrixBase &F, const KMatrix &K1, const KMatrix &K2)
63  { if (InitFromF(F,K1,K2)!=0) this->SetZero(); }
64 
65  /** @brief assuming K1 and K2 as calibrations of the cameras which refer to
66  the fmatrix, create the nearest valid essential matrix from F */
67  int InitFromF(const FMatrixBase &F, const KMatrix &K1, const KMatrix &K2);
68 
69  /** @brief find R and C(direction), such that maximum number of 3d points
70  triangulated from correspondences inlier1 and inlier2 are in front of
71  both cameras
72  @return 0=ok, <0 on error, e.g. no triangulation possible */
73  int GetRotationTranslation(RMatrix &R, Vector3<double> &C,
74  const std::vector<HomgPoint2D> &inlier1,
75  const std::vector<HomgPoint2D> &inlier2);
76 
77  /** @author woelk 07/2006 */
78  int GetRotationTranslation(Quaternion<double>& Q, Vector3<double> &C,
79  const std::vector<HomgPoint2D> &inlier1,
80  const std::vector<HomgPoint2D> &inlier2);
81 
82 
85  return *this;
86  };
87 
88  };
89 
90 
91 }
92 
93 #endif
94 
MatrixInitType
can be passed to matrix constructors to init the matrix with the most often used values ...
Definition: Matrix.hh:59
EMatrix(const MatrixInitType &i)
Definition: EMatrix.hh:60
class BIASGeometryBase_EXPORT Quaternion
Definition: RMatrixBase.hh:37
class representing an Essential matrix
Definition: EMatrix.hh:52
describes the epipolar relationship between a point and his mapping on a corresponding epipolar line...
Definition: FMatrixBase.hh:67
3D rotation matrix
Definition: RMatrix.hh:49
EMatrix(const FMatrixBase &F, const KMatrix &K1, const KMatrix &K2)
Definition: EMatrix.hh:62
class representing a Fundamental matrix
Definition: FMatrix.hh:46
Matrix3x3< T > & operator=(const Matrix3x3< T > &mat)
assignment operator
Definition: Matrix3x3.cpp:704
K describes the mapping from world coordinates (wcs) to pixel coordinates (pcs).
Definition: KMatrix.hh:48
EMatrix & operator=(const Matrix3x3< FMATRIX_TYPE > &f)
Definition: EMatrix.hh:83
EMatrix(const Matrix3x3< FMATRIX_TYPE > &f)
Definition: EMatrix.hh:58