Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
EightWaySymmetryHomg.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 // TODO: jw: merge EightWaySymmetry from BIAS/Base/Image and Geometry. (code duplication)
26 
27 #ifndef __EIGHT_WAY_SYMMETRY_HOMG_HH__
28 #define __EIGHT_WAY_SYMMETRY_HOMG_HH__
29 
30 #include <cmath>
31 #include <Base/Geometry/HomgPoint2D.hh>
32 #include <Base/ImageUtils/EightWaySymmetry.hh>
33 
34 namespace BIAS{
35 
36  /// direction of line if start is in coordinate origin
37  /// as given by compass
38  // the following is coming out of BIASIMage
39  // enum TLineType { LT_Invalid, E_NE, NE_N, N_NW, NW_W, W_SW, SW_S, S_SE,
40  // SE_E };
41 
42  // ostream& operator<<(ostream& os, const enum TLineType type);
43 
44  class EightWaySymmetryHomg : public EightWaySymmetry<double>
45  {
46  public:
47 
48  inline enum TLineType DetermineLineType(double& angle)
50 
51  /// not tested jet
53  HomgPoint2D& end)
54  { double s[2], e[2];
55  s[0]=start[0]/start[2];s[1]=start[1]/start[2];
56  e[0]=end[0]/end[1];e[1]=end[1]/end[2];
57  return EightWaySymmetry<double>::DetermineLineType(s[0], s[1], e[0],
58  e[1]); };
59 
60  /// transforms Original according to type in a way that
61  /// Transformed lies on a line with slope in [0,1)
62  inline void Transform(enum TLineType& type, HomgPoint2D& Original,
63  HomgPoint2D& Transformed)
64  { double o[2];
65  o[0]=Original[0]/Original[2];o[1]=Original[1]/Original[2];
66  Transformed[2]=1.0;
67  EightWaySymmetry<double>::Transform(type, o[0], o[1],Transformed[0],
68  Transformed[1]); }
69 
70  /// as above
71  template <class T>
72  inline void Transform(enum TLineType& type, Vector2<T>& Original,
73  Vector2<T>& Transformed)
74  { EightWaySymmetry<double>::Transform(type, Original[0], Original[1],
75  Transformed[0], Transformed[1]); }
76 
77  /// executes the inverse transformation to the above
78  inline void InverseTransform(enum TLineType& type,
79  HomgPoint2D& Transformed,
80  HomgPoint2D& Original)
81  { double t[2];
82  t[0]=Transformed[0]/Transformed[2];t[1]=Transformed[1]/Transformed[2];
83  Original[2]=1.0;
85  Original[0], Original[1]); };
86 
87  /// as above
88  template <class T>
89  inline void InverseTransform(enum TLineType& type,
90  Vector2<T>& Transformed,
91  Vector2<T>& Original)
92  { EightWaySymmetry<double>::InverseTransform(type, Transformed[0],
93  Transformed[1], Original[0],
94  Original[1]); }
95 
96  };
97 
98 
99 } // namespace BIAS
100 
101 #endif // __8_WAY_SYMMETRY_HOMG_HH__
void InverseTransform(enum TLineType &type, const T &Transformedx, const T &Transformedy, T &Originalx, T &Originaly)
executes the inverse transformation to the above
void Transform(enum TLineType &type, HomgPoint2D &Original, HomgPoint2D &Transformed)
transforms Original according to type in a way that Transformed lies on a line with slope in [0...
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
Definition: HomgPoint2D.hh:67
enum TLineType DetermineLineType(double &angle)
assumes angle is between (-pi, pi] as given by atan2
class for transforming any point to first octant
void InverseTransform(enum TLineType &type, Vector2< T > &Transformed, Vector2< T > &Original)
as above
void Transform(enum TLineType &type, Vector2< T > &Original, Vector2< T > &Transformed)
as above
void InverseTransform(enum TLineType &type, HomgPoint2D &Transformed, HomgPoint2D &Original)
executes the inverse transformation to the above
class Vector2 contains a Vector of dim.
Definition: Vector2.hh:79
enum TLineType DetermineLineType(double &angle)
void Transform(enum TLineType &type, const T &Originalx, const T &Originaly, T &Transformedx, T &Transformedy)
transforms Original according to type in a way that Transformed lies on a line with slope in [0...
direction of line if start is in coordinate origin as given by compass
TLineType
direction of line if start is in coordinate origin as given by compass