Specifications
Geometric Transforms
11-11
11
GetRotateShift
Computes shifts for iplRotate, given
the rotation center and angle.
void iplGetRotateShift(double
xCenter
, double
yCenter
,
double
angle
, double*
xShift
, double*
yShift
);
xCenter
,
yCenter
Coordinates of the rotation center for which you
wish to compute the shifts.
angle
The angle (in degrees) to rotate the image around
the point with coordinates (
xCenter
,
yCenter
).
xShift
,
yShift
Output parameters: the shifts along the x-andy-
axes to be passed to
iplRotate() in order to
achieve rotation around the specified center
(
xCenter
,
yCenter
) by the specified
angle
.
Discussion
Use the function iplGetRotateShift() if you wish to rotate an image
around an arbitrary center (
xCenter
,
yCenter
) rather than the origin (0,0).
Just pass the rotation center (
xCenter
,
yCenter
) and the angle of rotation
to
iplGetRotateShift(), and the function will recompute the shifts
xShift
,
yShift
.
Calling
iplRotate() with these
xShift
and
yShift
is equivalent to
rotating the image around the center (
xCenter
,
yCenter
).
Example 11-2 Rotating an Image
int example111( void ) {
IplImage *imga, *imgb;
const int width = 5, height = 5;
__try {
int i;
continued
☞