20 const double& Theta,
const T& BGVal = 0) {
22 const int InputWidth = InImg.
Width();
23 const int InputHeight = InImg.
Height();
25 const int OutputWidth = OutImg.
Width();
26 const int OutputHeight = OutImg.
Height();
28 const int HalfInputWidth = InputWidth/2;
29 const int HalfInputHeight = InputHeight/2;
31 const int HalfOutputWidth = OutputWidth/2;
32 const int HalfOutputHeight = OutputHeight/2;
34 const float K = (float)(InputWidth+OutputWidth+
35 InputHeight+OutputHeight);
37 const int ix1 = HalfInputWidth;
38 const int iy1 = HalfInputHeight;
40 const int ox1 = HalfOutputWidth;
41 const int oy1 = HalfOutputHeight;
43 const int ix2 = (int)K+HalfInputWidth;
44 const int iy2 = HalfInputHeight;
46 const int ox2 =
F2I(K*(
float)cos(Theta))+HalfOutputWidth;
47 const int oy2 =
F2I(-K*(
float)sin(Theta))+HalfOutputHeight;
50 ca.
Setup(ix1, iy1, ix2, iy2, ox1, oy1, ox2, oy2);
#define F2I(x)
Definition: utils.h:111
void Transform(CImg< T > &InImg, CImg< T > &OutImg, const T &BGVal=0)
Definition: affine.h:50
int Width() const
Definition: img.h:135
void Rotate(CImg< T > &InImg, CImg< T > &OutImg, const double &Theta, const T &BGVal=0)
Definition: rotate.h:19
void Setup(const int &in_x1, const int &in_y1, const int &in_x2, const int &in_y2, const int &out_x1, const int &out_y1, const int &out_x2, const int &out_y2)
Definition: affine.cpp:22
int Height() const
Definition: img.h:138