Morphing is the technology used to generate a result image by cross dissolve two different images. It is a powerful tool to generate intermediate frames for animation to convert from one fram to another frame smoothly.
There are several methods to implement morphing process. this paper present the method by convert image based on the relationship of a pair lines on two images.
To map the pixel X on destination image from pixel X' on source image by corresponsing lines P'Q' of source image and PQ of destination image.
u = (X-P).(Q-P) / (||Q-P||.||Q-P||) v = (X-P).Prependicular(Q-P) / (||Q-P||.||Q-P||) X' = P' + u.(Q'-P') + v.Prependicular(Q'-P') / (||Q'-P'||.||Q'-P'||)
With the above transformation formules, we can scan every pixels on the destination image and compute the corresponsing pixels on the source image.
For multiple pair of lines used to transform pixels from source image to destination image, the weight was introduced.
weight = power(power(length,p)/(a+dist),b) Where length is the length of a line dist is the distance from the pixel to the line a, b and p are constant that can be used to change the relative effect of the lines.
Summation the results of every line multiply by its weight to map each pixel from source image to destination image.
The above transformation algorithm can be used to create intermediate frames between two frames. For each intermediate frame create a new set of lines by interpolating the lines from their position in source image and destination image. Both images are distored towards the position of the lines in intermediate frame. These two resulting image are dissolved throughout the metamorphosis, so that at the begining, the image is completely same as source image. Halfway through themetamorphosis it is halfway between this two images, and finally at the end it is completely destination image.
Another issue of morphing is how to change the color for the intermediate frames. The simplest method is proportionally average the color get from source and destination images. For example if we need 10 frames from source to destination named frame 0 to frame 9, then the color of frame 0 will be 9/9 of source image and 0/9 of destination iamge. For frame 3, its color is 6/9 from source image and 3/9 from destination image.
This algorithm is very easy to implement, but the pair of lines between source and destination image needed to be similar, thereafter the source and destination image is better similiar also. If the pair of lines are too much different, then the intermediate frame may be serious distorted.
Another well know algorithm is divide the images by grids. The texture mapping method can be used to map images.