_



Morphing by the incredible geniuses Justin & Kenneth



what is morphing

Given 2 source images, we want to transform one to another smoothly through a sequence of intermediate frames.

how do we do it

Paper reference
We adopt the algorithm discussed in the Thaddeus Beier and Shawn Neely's Feature-Based Image Metamorphosis SIGGRAPH 92 paper.

The basica idea
The basic idea of the paper is as follows: on the 2 given source images, highlight pairs of control lines (called features) in the 2 images to capture their outline. Then interpolate the features in the 2 source images to obtain the features in the intermediate frame.

And then, with the features in the intermediate frame and the 2 source images, warp each of the source images to a temporary frame. Finally, cross-dissove those 2 temporary frames to get our intermediate frame.

difficulty we experienced

High sensitivity to how features are defined
Warping does not always work well because it is extremely sensitive to how features are defined in the 2 source images. For simple images, our code does work well. Yet, things can get poor for complicated images like faces. The 3 problems that we find are: (a) getting pixels that are sampled way out of the bound of the source images, (b) we get weird twist of the source image, and (c) some mysterious white dots in the final intermediate frame, which we found to be the direct consequence of (a). Click here to see some of our heartbreaking, screw-up intermediate frames.

__Our solution
We have spent tremendous amount of time (more than 50 hours combined) just trying to find out why we keep getting problems (a) and (b): we have gone over our code line by line for more than 5 times to ensure that every function does exactly what is required to do. We worked with simple images and found our code working reasonably well on them. We printed out the computed values of the pixel to sample. But still, we just could not find out why our code doesn't work fine sometimes.

In Beier and Neely's paper, there's no specific mentioning of these problems we have. All it says is that weird result can be corrected by adding a few more pairs of control lines in the 2 sources. And we experimented with such a suggestion. However, the problems still persist. By adjusting the control "a", "b", and "p" in the paper, we sometimes can avoid some of these problems, not rarely all of them entirely.

On the other hand, it is interesting in that when we put our intermediate frames into a movie, the result doesn't appear poor at all, even though some intermediate frames doesn't turn out perfectly.

Jaggy edges
Even for morphing of simple images, we can get uneven edges.

__Our solution
We applied the ordinary antialiasing to smooth out the jaggies. We did so by first computing the pixels of the entire intermediate frame, and then run the antialiasing on the frame.

result

heart to apple
movie | intermediate frames | source image 1 | source image 2

pentagon to its reflection
movie | intermediate frames | source image 1 | source image 2

ugly man to ugly lady
movie | intermediate frames | source image 1 | source image 2

BMW 323ci to 323it
movie | intermediate frames | source image 1 | source image 2

code

executable