Specifications
Geometric Transforms
11-17
11
WarpAffine
Warps an image by an affine transform.
void iplWarpAffine(IplImage*
srcImage
, IplImage*
dstImage
,
const double
coeffs
[2][3], int
interpolate
);
srcImage
Thesourceimage.
dstImage
The resultant image.
coeffs
The affine transform coefficients.
interpolate
The type of interpolation to perform for
resampling. Can be one of the following:
IPL_INTER_NN Nearest neighbor.
IPL_INTER_LINEAR Linear interpolation.
IPL_INTER_CUBIC Cubic interpolation.
+IPL_SMOOTH_EDGE Smooth edges of an image.
Can be added to interpolation
by using bitwise logical OR
(see Appendix B for details).
Discussion
The function iplWarpAffine() warps the source image by an affine
transformation according to the following formulas:
x’ =
coeffs
[0][0]·x +
coeffs
[0][1]·y +
coeffs
[0][2]
y’ =
coeffs
[1][0]·x +
coeffs
[1][1]·y +
coeffs
[1][2]
where x and y denote the original pixel coordinates; x’ and y’ denote the
pixel coordinates in the transformed image.
The interpolation specified by
interpolate
is used for resampling the
input image. To compute the affine transform parameters, use the functions
iplGetAffineBound(), iplGetAffineQuad() and
iplGetAffineTransform(). These functions are described in the sections
that follow.