|
Feature-Based Image Metamorphosis
|
A Matlab implementation of Feature-Based Image Metamorphosis is done. The results seem to be very good. For example, here are two examples:
A Cat morphing into a dog! Click for the movie (sorry its in WMV format)
The first image shows the cat, the second image shows a 50% morph of the cat and dog, and the third image shows the dog entirly. 10 picture morphing sequence
|
|
|
|
My second example shows two of my favorite entertainers. This is a morph from Madonna to Britney Spears. The sequence of pictures below are for cross dissolve values of 0%, 25%, 50%, 75%, and 100%. 20 picture morphing sequence
| |
|
|
Now if look at a couple other pictures, we can see what the algorithm is doing. The following images show the three feature lines I used to perform the morph between Madonna and Brittney. I used a feature line for the eyes, the center of the face on the nose, and the mouth. The first picture is the original Brittney picture with the feature lines selected. The second image shows Brittney morphed at 50%. Notice her mouth is smaller and face is rotated. The next picture shows the original Madonna picture with feature lines selected. Notice in the last image, Madonna's mouth is larger, and her head is rotated counter clockwise to match, more or less Brittney's head.
|
|
|
Source Code: FeatureMorph.m
I still have to build an interface to be able to interactively select the feature lines in each image. Application to real time processing: A single run of the code takes about 12 seconds on an image size of 250 X 236 pixels. The following breakdown of timing is important:
- First Image Morph: 1.8730 seconds
- Copying Pixels for first image (using bad double FOR loop): 4.0660 seconds
- Second Image Morph: 1.8620 seconds
- Copying Pixels for second image (using bad double FOR loop): 4.1660 seconds
When copying pixels, I have to look up matrix entries in two matrixes that contain the row and column coordinate. Currently I am unsure how to do this without a FOR loop. Also, I have to make sure that the value I look-up is within the range of the indexed matrix (i.e. between 1 and size(original image)). I believe a speedup of about a factor of 10 is possible for the FOR loops if I could implement it in Matlab efficient code (using find, etc.). The big time factor that I don't control is the number of features that the user wants to select. The number of feature lines depend on how precise of a morph and how you want the morph to appear.
|
|
View Morphing
|
I am not as far along with the View Morphing algorithm. I have pieces of code for this part, but nothing that works extremely well.
|
Calculate Fundamental Matrix
Normalize Points for Fundamental Matrix
|
|
The fundamental matrix is an important piece in the View Morphing algorithm. The prewarping transforms, H0 and H1, can be computed from the images themselves. Once the fundamental matrix is computed, any two images can be prewarped (i.e. made parallel) by choosing H0 and H1 such that H1'*F*H0 = FH. The method described in the Seitz and Dyer paper applies a rotation in depth that makes image planes parallel, followed by a transformation to align corresponding scanlines. Once the two prewarping transforms are obtained, they are applied to images I0 and I1 producing two prewarped images. The two prewarped images are morphed by linearly interpolating the positions and colors of corresponding points. Finally the third step is to apply HS to the morphed image to produce the output image. Notice the prewarped images only have to be computed once. This saves on the time of the algorithm for multiple postwarps. I've got most of the prewarp code written, but not fully debugged. This part of the project has taken more time than I had planned.
|
|
|