# Y sin cos

where d is the angle of rotation measured counterclockwise. In image processing, this is often not very useful because the coordinate origin is in the lower left-hand corner of the image. More often, we will need to rotate the image about its center y+ 2 Figure 12.3

Interpolation is necessary whenever a new grid of pixels does not exactly match an original pixel grid. This occurs when images are translated, rotated, scaled, or resampled. New values are computed by interpolating the values of the four pixels around the new pixel's location.

or around a point such as star image. To rotate a point (.x, y) about point (x0, y0), the equations become:

je' = x0 + (x -x0)cos\$ + (y -jy0)sin\$ / = y0-(x-x0)sm'& + (y-y0)cos'&.

Note that the point (x0, y0) does not move; it occupies the same location in the new image as it did in the original.

These equations yield the location of the new pixel, but to compute a new image, you need the inverse transform: that is, given the location of a new pixel, where was the original pixel in the original image? The inverse transform is:

Employing these equations, the rotation procedure—taking the argument th for the rotation angle, xO for the jc-axis center of rotation, and yO for the y-axis center of rotation—looks like this:

PROCEDURE ROTATE sinth = SIN(th) Original Image

Rotation around the Origin 