25 #ifndef __TextureTransformRotation__hh__
26 #define __TextureTransformRotation__hh__
28 #include <Base/Common/BIASpragmaStart.hh>
29 #include <Image/TextureTransform.hh>
30 #include <Base/Common/CompareFloatingPoint.hh>
50 const double& sx = src[0];
51 const double& sy = src[1];
52 sink[0] =
A_[0][0]*sx +
A_[0][1]*sy +
tx_;
53 sink[1] =
A_[1][0]*sx +
A_[1][1]*sy +
ty_;
65 if (!
Equal(testsink[0]+1e-4,sink[0]+1e-4, 1e-4) ||
66 !
Equal(testsink[1]+1e-4,sink[1]+1e-4, 1e-4)) {
67 BIASERR(testsink<<
" and "<<sink<<
" are not equal!!!");
92 const double sinphi = sin(
P_[0]);
93 const double cosphi = cos(
P_[0]);
96 const double y = src[1]-origin1_[1];
98 Jac[0][0] = -sinphi*x-cosphi*y;
99 Jac[1][0] = cosphi*x-sinphi*y;
106 const double sinphi = sin(
P_[0]);
107 const double cosphi = cos(
P_[0]);
109 const double x = src[0]-
origin1_[0];
110 const double y = src[1]-origin1_[1];
112 Jac[0][0] = -sinphi*x+cosphi*y;
115 Jac[1][0] = -cosphi*x-sinphi*y;
129 BIASASSERT(p.
Size()==1);
132 Ainv_[1][0] =
A_[0][1] = -sin(p[0]);
146 p[0] =
P_[0] - deltaP[0];
virtual bool TextureJacobianIsConstant() const
local warp is the same at any image position
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
virtual ~TextureTransformRotation()
int ParameterInversionJacobian(Matrix< double > &Jac) const
compute parameters for inverse operation and obtain the jacobian of the inverse parameters with respe...
const Vector2< double > & GetOrigin() const
origin relative to which rotation and scale is performed
double tx_
cached displacement and inverse
analytic properties of rotational image warp (around some point)
Vector< double > P_
current set of parameters, see SetParameters for meaning
Matrix< T > & newsize(Subscript M, Subscript N)
Vector2< double > origin1_
origin relative to which rotation and scale is performed
class for representing parameterized image warps, such as homography, displacement, ...
unsigned int Size() const
length of the vector
int MapBackward(const HomgPoint2D &sink, HomgPoint2D &src) const
map a point in image "source" to a point in image "sink"
int ParameterJacobianBackward(Matrix< double > &Jac, const HomgPoint2D &src)
transformed position change when parameters change
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
int MapForward(const HomgPoint2D &src, HomgPoint2D &sink) const
map a point in image "source" to a point in image "sink"
void SetOrigin(const Vector2< double > &origin1)
set origin in image1 and image2
Vector< T > & newsize(Subscript N)
bool ParameterJacobianIsConstant() const
the jacobian depends on x
virtual TextureTransformRotation * Clone() const
virtual covariant copy constructor, caller must eventually destroy the created object ...
void ComposeWithInverseDeltaP(const Vector< double > &deltaP)
concatenate *this and an inverse transform with param deltaP and save new parameter vector to *this...
Matrix2x2< double > A_
cached local warp and inverse
int ParameterJacobianForward(Matrix< double > &Jac, const HomgPoint2D &src)
transformed position change when parameters change
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_...
void SetParameters(const Vector< double > &p)
rotation(rad) with respect to origin_! x' = A*(x-origin)+origin where A==[cos -sin; sin cos] ...
Matrix2x2< double > Ainv_
TextureTransformRotation()