Note that we are simply multiplying each coordinate by s, the scale factor. A point at (2, 3) moves to (4, 6) when scaled by a factor of 2. Just as with rotation, however, we need to enlarge or shrink the image around the center or around an object of interest. To scale points relative to point (x0, y0), the equations become:
As in the rotation equations, the point (jc0, y0) occupies the same location in the new image as it did in the old image.
We can solve the equations above to yield the inverse transformation below. These generate the source coordinates for points in the new image:
Programming the scale transformation is essentially the same as programming rotation, with the exception of the following lines:
PROCEDURE SCALE (sc, xO, yO) The parameter sc is the scale factor. Of course, we must also replace the rotation equations with the equations for computing scale transform:
This scaling formulation works best for enlarging images. Enlarging an image by a scale factor of 2 or greater means that every pixel in the original image must be sampled as part of a new pixel at least four times, so that almost all of the information contained in the original image is carried forward into the new one.
For scaling factors less than 2.0, pixels in the original image are sampled less than four times. Adjacent pixels must be averaged, thus the image becomes slightly softer. At scaling factors near 1.0, you may see artifacts in the new image because some new pixels are the average of four old pixels, whereas others get their value almost entirely from a single old pixel. In noisy images, the result is a pattern of pixel-averaged smooth regions alternating with unsmoothed regions where the new pixels retain the noisiness of the original. These effects can be minimized by smoothing the entire image with a Gaussian convolution kernel before scaling.
At scaling factors less than 0.5, scaling misses some pixels altogether; but because the new image is smaller it may appear sharper despite the loss of image information. For large size reductions, smooth the image with a Gaussian blur before resampling. This insures that every pixel in the old image passes some of its information content into the reduced one.
Was this article helpful?