Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TextureTransformDisplacement.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 #ifndef __TextureTransformDisplacement__hh__
26 #define __TextureTransformDisplacement__hh__
27 
28 #include <Base/Common/BIASpragmaStart.hh>
29 #include <Image/TextureTransform.hh>
30 
31 
32 namespace BIAS {
33 
34  /** @class TextureTransformDisplacement
35  * @brief analytic properties of 2D image displacement
36  *
37  * See BIAS::TextureTransform for explanation of methods.
38  * @author koeser 01/2008
39  **/
41  public:
43  P_.newsize(2);
44  P_[0] = 0;
45  P_[1] = 0;
46  }
47 
49 
50  int MapForward(const HomgPoint2D& src, HomgPoint2D& sink) const {
51  sink[0] = src[0] + P_[0];
52  sink[1] = src[1] + P_[1];
53  sink[2] = 1;
54  return 0;
55  }
56 
57  int MapBackward(const HomgPoint2D& sink, HomgPoint2D& src) const {
58  src[0] = sink[0] - P_[0];
59  src[1] = sink[1] - P_[1];
60  src[2] = 1;
61  return 0;
62  }
63 
65  Matrix2x2<double>& Jac) const {
66  Jac.SetIdentity();
67  return 0;
68  }
69 
71  Matrix2x2<double>& Jac) const {
72  Jac.SetIdentity();
73  return 0;
74  }
75 
76  virtual bool TextureJacobianIsConstant() const { return true;};
77 
79  Jac.newsize(2,2);
80  Jac[0][0] = 1; Jac[0][1] = 0;
81  Jac[1][0] = 0; Jac[1][1] = 1;
82  return 0;
83  }
84 
86  Jac.newsize(2,2);
87  Jac[0][0] = -1; Jac[0][1] = 0;
88  Jac[1][0] = 0; Jac[1][1] = -1;
89  return 0;
90  }
91 
92  bool ParameterJacobianIsConstant() const { return true;};
93 
94  /** @brief dx,dy */
95  void SetParameters(const Vector<double>& p) {
96  BIASASSERT(p.Size()==2);
97  P_ = p;
98  }
99 
101  P_[0] -= deltaP[0];
102  P_[1] -= deltaP[1];
103  }
104 
106  // inverse is simply inverse angle: alpha -> -alpha
107  Jac.newsize(2,2);
108  Jac[0][1] = Jac[1][0] =0;
109  Jac[0][0] = Jac[1][1] = -1;
110  return 0;
111  }
112 
114  return new TextureTransformDisplacement(*this);
115  }
116  protected:
117 
118  };
119 
120 } // end namespace BIAS
121 
122 #endif
int ParameterInversionJacobian(Matrix< double > &Jac) const
compute parameters for inverse operation and obtain the jacobian of the inverse parameters with respe...
int TextureJacobianBackward(const HomgPoint2D &sink, Matrix2x2< double > &Jac) const
shape change of the local region when mapping backward
void SetIdentity()
set the elements of this matrix to the identity matrix
Definition: Matrix2x2.hh:251
void ComposeWithInverseDeltaP(const Vector< double > &deltaP)
concatenate *this and an inverse transform with param deltaP and save new parameter vector to *this...
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
Definition: HomgPoint2D.hh:67
Vector< double > P_
current set of parameters, see SetParameters for meaning
analytic properties of 2D image displacement
Matrix< T > & newsize(Subscript M, Subscript N)
Definition: cmat.h:269
class for representing parameterized image warps, such as homography, displacement, ...
unsigned int Size() const
length of the vector
Definition: Vector.hh:143
int MapForward(const HomgPoint2D &src, HomgPoint2D &sink) const
map a point in image &quot;source&quot; to a point in image &quot;sink&quot;
int ParameterJacobianForward(Matrix< double > &Jac, const HomgPoint2D &src)
transformed position change when parameters change
Vector< T > & newsize(Subscript N)
Definition: vec.h:220
virtual bool TextureJacobianIsConstant() const
return true if the texture jacobian does not depend on the image position
bool ParameterJacobianIsConstant() const
return true, if the parameter jacobian does not depend on the image position
int MapBackward(const HomgPoint2D &sink, HomgPoint2D &src) const
map a point in image &quot;source&quot; to a point in image &quot;sink&quot;
int TextureJacobianForward(const HomgPoint2D &src, Matrix2x2< double > &Jac) const
shape change of the local region when mapping forward
virtual TextureTransformDisplacement * Clone() const
virtual covariant copy constructor, caller must eventually destroy the created object ...
void SetParameters(const Vector< double > &p)
dx,dy
int ParameterJacobianBackward(Matrix< double > &Jac, const HomgPoint2D &src)
transformed position change when parameters change