25 #include <Base/Common/BIASpragmaStart.hh>
26 #include <Image/TextureTransform.hh>
37 HomgPoint2D sink_left, sink_right, sink_up, sink_down;
50 Jac[0][0] = sink_right[0] - sink_left[0];
51 Jac[1][0] = sink_right[1] - sink_left[1];
52 Jac[0][1] = sink_down[0] - sink_up[0];
53 Jac[1][1] = sink_down[1] - sink_up[1];
66 HomgPoint2D source_left, source_right, source_up, source_down;
69 if (MapBackward(locsink, source_left))
return -1;
71 if (MapBackward(locsink, source_right))
return -1;
74 if (MapBackward(locsink, source_up))
return -1;
76 if (MapBackward(locsink, source_down))
return -1;
79 Jac[0][0] = source_right[0] - source_left[0];
80 Jac[1][0] = source_right[1] - source_left[1];
81 Jac[0][1] = source_down[0] - source_up[0];
82 Jac[1][1] = source_down[1] - source_up[1];
91 const unsigned int numvars = p.
Size();
98 for (
unsigned int j=0; j<numvars; j++) {
100 double myeps = 0.02 * fabs(p[j]);
101 if (myeps<1e-9) myeps = 1e-9;
102 pchanged[j] += myeps;
104 SetParameters(pchanged);
109 Jac[0][j] = p1[0]/myeps;
110 Jac[1][j] = p1[0]/myeps;
122 const unsigned int numvars = p.
Size();
126 MapBackward(sink, ref);
129 for (
unsigned int j=0; j<numvars; j++) {
131 double myeps = 0.02 * fabs(p[j]);
132 if (myeps<1e-9) myeps = 1e-9;
133 pchanged[j] += myeps;
135 SetParameters(pchanged);
137 MapBackward(sink, p1);
140 Jac[0][j] = p1[0]/myeps;
141 Jac[1][j] = p1[0]/myeps;
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
virtual int ParameterJacobianBackward(Matrix< double > &Jac, const HomgPoint2D &sink)
transformed position change when parameters change
Matrix< T > & newsize(Subscript M, Subscript N)
virtual int TextureJacobianForward(const HomgPoint2D &src, Matrix2x2< double > &Jac) const
shape change of the local region when mapping forward
virtual int ParameterJacobianForward(Matrix< double > &Jac, const HomgPoint2D &src)
transformed position change when parameters change
unsigned int Size() const
length of the vector
virtual int MapForward(const HomgPoint2D &src, HomgPoint2D &sink) const =0
map a point in image "source" to a point in image "sink"
virtual int TextureJacobianBackward(const HomgPoint2D &sink, Matrix2x2< double > &Jac) const
shape change of the local region when mapping backward