Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
HomgPoint2DCov.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 _HomgPoint2DCov_hh_
27 #define _HomgPoint2DCov_hh_
28 
29 #include <Base/Math/Matrix2x2.hh>
30 #include <Base/Math/Matrix3x3.hh>
31 #include <Base/Common/CompareFloatingPoint.hh>
32 
33 namespace BIAS {
34 
35  class HomgPoint2D;
36 
37  /** @class HomgPoint2DCov
38  @brief class representing the covariance matrix of a homogenous point 2D
39  @author woelk 03/2006 */
40  class BIASGeometryBase_EXPORT HomgPoint2DCov
41  : public Matrix3x3<double>
42  {
43  public:
45 
47 
48  explicit HomgPoint2DCov(const Matrix2x2<double>& m);
49 
50  explicit HomgPoint2DCov(const Matrix3x3<double>& m);
51 
52  explicit HomgPoint2DCov(const Matrix<double>& m);
53 
54  explicit HomgPoint2DCov(const TNT::Matrix<double>& m);
55 
56  virtual ~HomgPoint2DCov();
57 
58  /** @brief homogenizes p and *this
59  @author woelk 03/2006 */
60  void Homogenize(HomgPoint2D& p);
61 
62  /** @brief normalizes p and *this
63  @author woelk 03/2006 */
64  void Normalize(HomgPoint2D& p);
65 
66  Matrix2x2<double> GetEuclidean() const;
67 
68  void SetEuclidean(const Matrix2x2<double>& m);
69 
70  inline bool IsHomogenized() const {
71  return (Equal((*this)[0][2], 0.0) && Equal((*this)[1][2], 0.0) &&
72  Equal((*this)[2][0], 0.0) && Equal((*this)[2][1], 0.0) &&
73  Equal((*this)[2][2], 0.0));
74  }
75 
76  inline bool IsZero() const {
77  return ( Equal((*this)[0][0], 0.0) && Equal((*this)[0][1], 0.0) &&
78  Equal((*this)[0][2], 0.0) && Equal((*this)[1][0], 0.0) &&
79  Equal((*this)[1][1], 0.0) && Equal((*this)[1][2], 0.0) &&
80  Equal((*this)[2][0], 0.0) && Equal((*this)[2][1], 0.0) &&
81  Equal((*this)[2][2], 0.0) );
82  }
83 
84  /** @brief averages transposed elements to make symmetric */
85  void MakeSymmetric();
86 
87  /** @brief checks whether matrix is symmetric */
88  bool CheckSymmetry() const;
89 
90  /** @brief Sets from matrix and enforces symmetry */
91  void SetAndMakeSymmetric(const Matrix3x3<double> &m);
92 
93  };
94 
95 }
96 
97 #endif // _HomgPoint2DCov_hh_
MatrixInitType
can be passed to matrix constructors to init the matrix with the most often used values ...
Definition: Matrix.hh:59
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
Definition: HomgPoint2D.hh:67
class representing the covariance matrix of a homogenous point 2D
class BIASGeometryBase_EXPORT HomgPoint2DCov
bool IsZero() const
is a &#39;fixed size&#39; quadratic matrix of dim.
Definition: Matrix.hh:54
bool Equal(const T left, const T right, const T eps)
comparison function for floating point values See http://www.boost.org/libs/test/doc/components/test_...
class BIASGeometryBase_EXPORT HomgPoint2D
bool IsHomogenized() const