CS194-26 Project 3: Face Morphing

Overview

This project centered on combining a simple cross-dissolve with a mesh warp in order to seamlessly warp between two pictures.

Defining Correspondences

I used the correspondences from the Danes dataset on my own test images. In order to choose the points, I used ginput from matplotlib, and a small script in order to store these points in a pickled numpy array. For triangulization, I used the Delaunay triangulization function as provided in scipy.

Computing a Midpoint Face: The Morph Sequence

In order to create a smooth interpolation between two images, we have to interpolate the correspondence points and warp both images to the new mesh before doing a cross-dissolve. In order to do this, I created a function called morph as defined in the spec: morphed_image = morph(im1, im2, im1_pts, im2_pts, tri, warp_frac, dissolve_frac)

Within the morph function we do the following:

Image morph results:

Image morph video:

The intermediate frames of the image warp are quite realistic compared to just a simple cross-dissolve.

Mean Face of a Population

Using the Danes dataset, I calculated the population average of around 30 adult Danish males and transformed a few of the Danes to align with the mesh of the average face:

On the left is George's face being warped to the average mesh, and the average face being warped to George's mesh:

Same for Sheen:

Caricatures

In order to create a caricature we just have to extrapolate further than 1 when calling the morph function. Extrapolating works to a certain extent, but breaks when we try to go too far because the triangles begin to diverge from each other.

Bells and Whistles 1: Danish Movie

This is an extra video that cycles through everyone in the Danes dataset, seamlessly blending between them. (the song is a random Danish song, for authenticity)

Bells and Whistles 2: Sexy Men Through the Ages

Here is another video that blends through a bunch of the winners of People Magazine's "sexiest man alive" award. Since the men's poses very somewhat from cover to cover, the points are hard to place well and the interpolations end up being quite ugly in places. Most jarringly, one of the images has an incorrectly annotated eye, causing it to flip between transitions. I left it in because of time constraints and because I thought the way a misalignment is interpolated looks visually interesting.

Bells and Whistles 4: Interactivity

This bell/whistle is hard to show in a static form, because it's an interactive tool that lets the user specify the blending parameters and play around with warp_frac and dissolve_frac in real time:

Bells and Whistles 5: SMH

Since the Danes dataset includes pictures of the same people looking left and right as well, I was able to calculate the averages of these images and use them as a way to warp George to look to the left and the right. Here are the averages:

I made videos of both the average person and George shaking their heads:

George looks a little more clunky because his facial structure is being warped into an average person's, and also because his face is bigger in his image, which makes him get bigger when facing forward.