To morph images together, we need to do this:
Part 1: Morphing
First, use ginput
to take in points and use Delauney triangulation to generate a set of triangles that'll cover the areas we want to morph.
Part 2: Midway Image Next, warp each triangle in both images into the intermediate shape between the source and destination image by computing an inverse affine transformation for the two images. Then cross-dissolve the colors for both, resulting in a midway image like below.
Part 3: Morph
Repeat part 2, except instead setting the transformation to come from 50% source and 50% destination image, we vary the fraction between ranges [0, 1].
We used 43 frames for this .gif.
Part 4: Population Average We decided to find the average female face in the Brazillian FEI Face Database. Given their point data, we found the average face shape. Then we warped every image in the dataset into this average shape. Most did not look good. Here's a small subset:
After warping, we took each of the resulting images and averaged them together. She looks pretty nice!
Left to right: normal, average shape on Joyce, Joyce's shape on average face
Part 5: Caricature To produce a caricature of myself, I took the difference between my correspondance points and the mean face, multiplied by a scalar, then added the value back to the mean points. This created some weird caricatures.
Left to right: normal, scalar = 1.2, scalar = -1.2
Bells and Whistles: Add a Smile I wanted to add a bigger smile to my face, so I manually warped my face in Photoshop to a smile, and then ran my code to warp the original image to the smiley-image I had Photoshopped earlier. Works!