Assignment Description

Due: Saturday July 10th 23:59:59 PST

For this assignment we will build a morph effect like the morphing of faces at the end of Michael Jackson's Black or White video. (Click to see from 5m30s in.) Your simplest result will be the following:

Assignment Instructions

Your assignment is to implement the research paper "Feature-Based Image Metamorphosis" by t. Beier from SIGGRAPH 1992. This assignment combines 2D geometry (feature vectors describing warps) and image processing (blending two images and warping pixels). Your main reference will be the skeleton code and the research paper.

Start by reading Feature-Based Image Metamorphosis, available here (html) and here (pdf). Pay special attention to the whole section 3, which describes the algorithm in detail. COMPLETELY READ THE PAPER BEFORE ATTEMPTING ANY IMPLEMENTATION! Many things are explained in footnotes or later on in the paper, so you will avoid getting stuck by reading the whole paper first.

We will provide two example morphs for you - warping an F, and morphing Bush into Obama. We expect you to submit an image sequence of 11 images, morphing between the first and second image for both of these examples in t=0.1 increments from 0.0 to 1.0.

The paper defines three parameters - a, b, and p. We set these parameters as { a : 0.5, b : 1, p : 0.2 } since that gave us decent results. Feel free to experiment with these values, and note the parameters you used in a readme.txt file.

You can clamp the edges of the image - thus, requesting pixels beyond the border of the image gives you horizontally (or vertically) closest pixel on the image.

Download the skeleton code here. (Jul 6th 1pm)

Inside the skeleton code zip you will find the following input files:

Assignment Hints

Implementing this algorithm consists of three distinctly different milestones:

We suggest that you first implement the blending of two images, and use linear interpolation of each color of each of the pixels. Please see chapter 2.10 of Shirley (Fundamentals of Computer Graphics) for a better handling of linear interpolation of vectors than Wikipedia.

Once your blending works, turn blending off, and write the simple algorithm to warp an image with a single feature vector. Write to disk the result of the first and second images warped, and confirm that this looks right. For the F, if you only use the second feature vector, you will rotate both images in opposite directions.

Once you can distort an image using a single feature vector, now extend the algorithm to use all the feature vectors. Check the individual results of this before putting it together with the blend and rendering an image sequence.

Understanding the skeleton code: We provide you with skeleton code consisting of 4 files:

You only need to modify morph.cpp. Please read the comments inside this file! Morph reads in two lists of feature vectors (one for each image) and makes that available as a c++ vector of structs. Look in util.h to see this struct.

Understanding the time (t) parameter: Time is used to describe both how "far into" the morph or how "far along" a linear interpolation process is, and time is normalized to the range 0 to 1. This means that at time 0, you see the first source image (for example, 1a.jpg) during the morph, and at time 1 you see the second source image (for example, 1b.jpg). Similarly, if you linearly interpolate two colors, at t=0 the resulting color is the first color, and at t=1 the resulting color is the second color. At t=0.5 both colors and both images in the morph are equally mixed - that is, a blend of 50% color 1 and 50% color 2.

Using algebra3.h for vectors: In this assignment you will be working with vectors. algebra3.h is already included and used in the FeatureVector struct. Operations such as minus and dot product of vec2's are implemented in this library, so you can use that for all your mathematical calculations. Look at the top of algebra3.h to see what is available.

Extra Credit

You can get up to 20% of extra credit on this project. You can implement any of the following and submit the results as consideration for extra credit:

Submission Instructions

You need to submit both your results and source code. Your submission directory should contain at the very least:

Source: We expect all your work to be inside morph.cpp, and we will drop this into our own build system and attempt to compile it.

More results? If you do the extra credit and produce more results, please include these images as [ia.jpg, ib.jpg and ip.txt] for the source images and feature vectors file, where i is from [3...] depending on how many extra images you are submitting.

Expected results

Here is our rendering of bush into obama: