Visual Effects (Introduction to Video and Image Processing) Part 2

Twirl Transformation

Geometric transformations can easily become so complicated that the backward mapping is very hard or even impossible to derive. Such transformations are therefore often defined directly in the output domain, meaning that the forward mapping is not defined but only the backward mapping. The next three transformations are of this type. The first is the twirl transformation, which is inspired by the polar transformation, seeEqs. 11.1 and 11.2. Therotation angle θ is now defined as

tmp7470-120_thumb[2]

where φ is the rotation baseline and the other parameters are defined as for the polar transformation. The effect of the transformation is that the center remains at the same position and the rest of the pixels are rotated around the center with a rotation angle that is maximum (φ degrees) near the center and becomes smaller the closer to the image corners a pixel is. The final backward mapping is defined as

tmp7470-121_thumb[2]


 

The twirl transformation

Fig. 11.11 The twirl transformation

So, for each pixel (x’,y’) in the output image, we calculate a pixel position in the input image (x, y) using Eqs. 11.12 and 11.13. If the calculated pixel position is not within the input image, we set (x’,y’) to black. In Fig. 11.11 the twirl transformation is illustrated.

Spherical Transformation

This transform zooms in on the center of the image. The size of the zoomed area is defined by S. The actual zoom effect is similar to how a lens would bend the light. This is normally referred to as the refractive index, n. The backward mapping is defined as

tmp7470-123_thumb[2]

where S and n are defined by the user, and Ax and Ay are defined as above. Equations 11.14 and 11.15 are only defined for r < S. When this is not the case the transformation is reduced to x = x ‘ and y = y’ .As for the transformation above, we will insert a black pixel if the transformation results in a pixel outside the input image. In Fig. 11.12 the spherical transformation is illustrated.

The spherical transformation

Fig. 11.12 The spherical transformation

The ripple transformation

Fig. 11.13 The ripple transformation

Ripple Transformation

Another interesting non-linear geometric mapping is the ripple transformation. It distorts the image locally using a sinus function. The effect is that an overall wave pattern is introduced to the image. The backward mapping for the ripple transformation is defined as

tmp7470-126_thumb[2]

where ax and ay are the amplitudes of the wave pattern in the x- and y-directions, respectively and œx and œy control the frequencies of the waves in the x- and y-directions, respectively. In Fig. 11.13 the ripple transformation is illustrated.

A local geometric transformation based on rotation

Fig. 11.14 A local geometric transformation based on rotation

Local Transformation

In the four geometric transformations above, all pixels go through the same mapping process and we can therefore refer to such transformations as global. This need not be the case and we can apply different transformations locally, hence a local transformation. Obviously this can result in many different outputs by combining the four transformations above plus those presented in Chap. 10. Here we provide an example based on rotation.

First we copy the input image to the output image in order to avoid empty pixels in the output. Next we divide the input image into a number of squares each having the size S x S. Each square in the input is now rotated and mapped to the output image. The rotation angle is either θ degrees or -θ degrees, depending on its position in the input. That is, the first square is rotated θ degrees. The second -θ degrees. The third θ degrees and so on. The actual rotation is done using backward mapping. The effect is shown in Fig. 11.14 for two different parameter settings.

Further Information

An alternative approach to perform a local geometric transformation is to use warping. If we recall the analogy to magic mirrors, warping corresponds to the glass of the mirror being shaped differently depending on its position on the mirror. Compared to the local approach described above, warping ensures that we do not have abrupt changes in the output as seen in Fig. 11.14(b). In warping, the input image is divided into a number of triangles, which are then each mapped by an affine transformation, see Sect. 10.1, to the output image, see Fig. 11.15.

Another use of warping is found in morphing. Morphing is the process of mapping one image into another image. This is seen in for example TV commercials where a wild animal is mapped into a beautiful woman. Morphing is based on knowing where a number of keypoints in one image should end up in the other image, for example the position of eyes, ears and mouth. These points are used to calculate appropriate coefficients for the warping. Besides changing the shape of the image using warping, morphing also interpolates the intensities of the two images using alpha blending, see Sect. 4.6.

An example of warping, where an image is divided into 32 triangles each having its own affine transformation

Fig. 11.15 An example of warping, where an image is divided into 32 triangles each having its own affine transformation

Different visual effects

Fig. 11.16 Different visual effects

As mentioned above an endless number of different effects can be created based on pixel manipulation and/or geometric transformations. In Fig. 11.16 the effects of nine additional methods are illustrated.

Next post:

Previous post: