Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TextureTransformHomography.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 __TextureTransformHomography__hh__
26 #define __TextureTransformHomography__hh__
27 
28 #include <Base/Common/BIASpragmaStart.hh>
29 #include <Image/TextureTransform.hh>
30 
31 // should be smaller than 1 to account for small changes non-translational part:
32 #define PROJECTIVE_SENSITIVITY 1e-4
33 #define AFFINE_SENSITIVITY 1e-2
34 
35 namespace BIAS {
36 
37  /** @class TextureTransformHomography
38  * @brief analytic properties of homography transformation of an image
39  *
40  * See BIAS::TextureTransform for explanation of methods.
41  * @author koeser 01/2008 */
42  class BIASImage_EXPORT TextureTransformHomography: public TextureTransform {
43  public:
45  P_.newsize(8);
46  P_[0] = P_[1] = P_[2] = P_[3] = P_[4] = P_[5] = P_[6] = P_[7] = 0.0;
47  }
48 
50 
51  int MapForward(const HomgPoint2D& src, HomgPoint2D& sink) const;
52 
53  int MapBackward(const HomgPoint2D& sink, HomgPoint2D& src) const;
54 
56  Matrix2x2<double>& Jac) const {
57  H_.GetJacobian(src, Jac);
58  return 0;
59  }
60 
62  Matrix2x2<double>& Jac) const {
63  Hinv_.GetJacobian(sink, Jac);
64  return 0;
65  }
66 
67  virtual bool TextureJacobianIsConstant() const { return false; };
68 
69  int ParameterJacobianForward(Matrix<double>& Jac, const HomgPoint2D& src);
70 
71  int ParameterJacobianBackward(Matrix<double>& Jac, const HomgPoint2D& src);
72 
73  bool ParameterJacobianIsConstant() const { return false;};
74 
75  int ParameterInversionJacobian(Matrix<double>& Jac) const;
76 
77  /** @brief h11-1, h12, h13, h21, h22-1, h23, h31, h32 (h33==1 assumed) */
78  void SetParameters(const Vector<double>& p);
79  void ComposeWithInverseDeltaP(const Vector<double>& deltaP);
80  void ComposeWithDeltaP(const Vector<double>& deltaP);
81 
82  virtual TextureTransformHomography* Clone() const {
83  return new TextureTransformHomography(*this);
84  }
85 
86  /** @brief given H, compute a parameter vector */
87  Vector<double> ExtractParameters(const BIAS::HMatrix& H) const;
88 
89  /** @brief given parameters, compute H */
90  BIAS::HMatrix ConstructHFromParameters(const Vector<double>&p) const;
91 
92  protected:
94 
95  };
96 
97 
98 
99 } // end namespace BIAS
100 
101 #endif
bool ParameterJacobianIsConstant() const
return true, if the parameter jacobian does not depend on the image position
virtual bool TextureJacobianIsConstant() const
return true if the texture jacobian does not depend on the image position
analytic properties of homography transformation of an image
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
Definition: HomgPoint2D.hh:67
a 3x3 Matrix describing projective transformations between planes
Definition: HMatrix.hh:39
virtual TextureTransformHomography * Clone() const
virtual covariant copy constructor, caller must eventually destroy the created object ...
class for representing parameterized image warps, such as homography, displacement, ...
int TextureJacobianForward(const HomgPoint2D &src, Matrix2x2< double > &Jac) const
shape change of the local region when mapping forward
int TextureJacobianBackward(const HomgPoint2D &sink, Matrix2x2< double > &Jac) const
shape change of the local region when mapping backward