Translation

Translation means shifting an image up, down, or from side to side. The image itself is not changed, but simply moved to a new location. Each pixel P(x, y) becomes a new pixel P(x', /). The equations for translating a point are:

where x and y' are the coordinates of P in the new image, x and y are the coordinates in the old image, and xT and yT are the shifts in the two axes.

There are many reasons for wanting to employ translation, but the most common application is to register one image precisely with another. Once they are registered, the images can be blinked or combined.

Although the mathematics of translation are straightforward, in this section

Translation in y-axis Translation in xand y

Figure 12.1 Translation appears to be the simplest possible image transform—the image is simply moved left, right, up, or down. However, to be really useful, translation must work when you need to shift the image by a non-integer number of pixels, and that means finding pixel values between pixels.

Translation in y-axis Translation in xand y

Figure 12.1 Translation appears to be the simplest possible image transform—the image is simply moved left, right, up, or down. However, to be really useful, translation must work when you need to shift the image by a non-integer number of pixels, and that means finding pixel values between pixels.

we look at programming translation to illustrate the difficulties that beset programming geometric transforms.

Assuming that you have an original image array, old (0 TO xmax),and a second array, new (0 TO ymax), to receive the translated image, you might initially try to implement translation like this:

FOR y = 0 to ymax FOR x = 0 TO xmax xp = x + xt yp = y + yt new(xp,yp) = old(x,y) NEXT x

NEXT y where x and y are the coordinates in the original image, xp and dinates of the new location, xt and yt are integer translations in and the expressions (0 TO xmax) and (0 TO ymax) define aries in the x and y axes, respectively.

Unfortunately, this will not work because xp and yp will be assigned values outside the bounds of the new () array. Furthermore, the routine never writes to parts of the new () array, leaving some parts of the new image either zero or not defined.

yp are the coor-the x and y axes, the array bound-

To make sure that every point in new () is evaluated, you must write the loops to generate a new image rather than scan the old image. This necessitates recasting the translation equations to yield x instead of x'\

Was this article helpful?

0 0
Telescopes Mastery

Telescopes Mastery

Through this ebook, you are going to learn what you will need to know all about the telescopes that can provide a fun and rewarding hobby for you and your family!

Get My Free Ebook


Post a comment