20 #ifndef __RescaleTransfer_hh__
21 #define __RescaleTransfer_hh__
23 #include <Base/Debug/Exception.hh>
24 #include <Base/Math/Vector2.hh>
25 #include <Base/Geometry/HomgPoint2D.hh>
76 static void Up(
const double &x,
const double &y,
const double &factor,
77 double &new_x,
double &new_y);
89 static void Down(
const double &x,
const double &y,
const double &factor,
90 double &new_x,
double &new_y);
111 Up(
const double &x,
const double &y,
const double &factor,
112 double &new_x,
double &new_y)
114 new_x = (x+0.5)*factor-0.5;
115 new_y = (y+0.5)*factor-0.5;
123 dst[0] = (src[0]+0.5)*factor-0.5;
124 dst[0] = (src[1]+0.5)*factor-0.5;
136 const double w2 = src[2]*0.5;
137 dst[0] = (src[0] + w2)*factor-w2;
138 dst[1] = (src[1] + w2)*factor-w2;
144 Down(
const double &x,
const double &y,
const double &factor,
145 double &new_x,
double &new_y)
147 if (
Equal(factor, 0.)){ BEXCEPTION(
"RescaleTransfer: division by zero"); }
148 new_x = (x+0.5)/factor-0.5;
149 new_y = (y+0.5)/factor-0.5;
157 if (
Equal(factor, 0.)){ BEXCEPTION(
"RescaleTransfer: division by zero"); }
158 dst[0] = (src[0]+0.5)/factor-0.5;
159 dst[0] = (src[1]+0.5)/factor-0.5;
166 if (
Equal(factor, 0.)){ BEXCEPTION(
"RescaleTransfer: division by zero"); }
172 const double w2 = src[2]*0.5;
173 dst[0] = (src[0] + w2)/factor-w2;
174 dst[1] = (src[1] + w2)/factor-w2;
179 #endif // __RescaleTransfer_hh__
class HomgPoint2D describes a point with 2 degrees of freedom in projective coordinates.
static void Down(const double &x, const double &y, const double &factor, double &new_x, double &new_y)
transfer to smaller image if factor > 1.
Transfer of pixel coordinates for pixel centric reference systems.
static void Up(const double &x, const double &y, const double &factor, double &new_x, double &new_y)
transfer to bigger image if factor > 1.
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_...