Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RParametrization.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 __RParametrization_hh__
27 #define __RParametrization_hh__
28 
29 #include <bias_config.h>
30 
31 #include <Base/Math/Vector.hh>
32 #include <Base/Math/Matrix.hh>
33 #include <Base/Geometry/Quaternion.hh>
34 #include <Geometry/RMatrix.hh>
35 
36 #include <iostream>
37 
38 namespace BIAS {
39 
40  //template <class T> class BIASGeometryBase_EXPORT Quaternion;
41  //class BIASGeometryBase_EXPORT RMatrixBase;
42 
43 #define Q_TYPE double
44 
45  /** @class RParametrization
46  @brief Slim class bundeling rotation matrix parametrization and
47  associated covariance matrix.
48 
49  The rotation is parametrized as a quaternion
50 
51  \author woelk 11/2006 */
52  class BIASGeometryBase_EXPORT RParametrization
53  {
54  public:
56 
58  const Matrix<Q_TYPE>& covariance);
59 
60  /** Set this from R parametrization. Zeros associated
61  covarinace matrix */
62  void Set(const Vector<Q_TYPE>& Qvec);
63 
64  /** Set this from orientation and covariance */
65  inline void Set(const Vector<Q_TYPE>& Qvec, const Matrix<Q_TYPE>& Cov)
66  { Set(Qvec); SetCovarianceMatrix(Cov); }
67 
68  /** Sets covariance matrix from Cov. Cov must be a 4x4 symmetric positiv
69  definit matrix (i.e. a covariance matrix) */
70  void SetCovarianceMatrix(const Matrix<Q_TYPE>& Cov);
71 
72  /** returns a vector of dimension 6 where first 2 entries are
73  the epipole and the last 4 entries are the quaternion orientation */
74  inline const Vector<Q_TYPE>& GetVec() const
75  { return Q_; }
76 
77  /** returns the covariance matrix associated with the EQ vector */
78  inline const Matrix<Q_TYPE>& GetCovarianceMatrix() const
79  { return Cov_; }
80 
81  /** returns the rotation matrix computed from parametrization */
82  RMatrixBase GetRotationMatrix() const;
83 
84  /** returns the quaternion */
85  Quaternion<Q_TYPE> GetQ() const;
86 
87  bool Load(const std::string& file);
88 
89  bool Save(const std::string& file) const;
90 
91  protected:
94 
95  };
96 
97  BIASGeometryBase_EXPORT std::ostream& operator<<(std::ostream &os, const RParametrization& p);
98 
99  BIASGeometryBase_EXPORT std::istream& operator>>(std::istream &is, RParametrization& p);
100 
101 }
102 
103 
104 #endif
const Vector< Q_TYPE > & GetVec() const
returns a vector of dimension 6 where first 2 entries are the epipole and the last 4 entries are the ...
const Matrix< Q_TYPE > & GetCovarianceMatrix() const
returns the covariance matrix associated with the EQ vector
Slim class bundeling rotation matrix parametrization and associated covariance matrix.
void Set(const Vector< Q_TYPE > &Qvec, const Matrix< Q_TYPE > &Cov)
Set this from orientation and covariance.
std::ostream & operator<<(std::ostream &os, const Array2D< T > &arg)
Definition: Array2D.hh:260
Implements a 3D rotation matrix.
Definition: RMatrixBase.hh:44
class for rotation with axis and angle
BIASCommon_EXPORT std::istream & operator>>(std::istream &is, BIAS::TimeStamp &ts)
Standard input operator for TimeStamps.
Definition: TimeStamp.cpp:157