CS194: Project 3

Leanna Yu (cs194-26-aff)


Face Morphing

For this project, we will produce a "morph" animation of two or more faces. To morph one image into the other, we perform a warp of the image shape and cross-dissolve the image colors to provide for a smoother-looking transition. Corresponding points between the two images will be the anchor for the morph, as we want to transform one set of corresponding points to that of the the other. From there the idea is to tranform each triangulation made from the corresponding points into the other, by implementing an affine warp for each triangle from the source to destination image.

Defining Correspondences

We want to morph Anne Hathaway into Meryl Streep, inspired by the film The Devil Wears Prada. Both images are portraits taken by Martin Schoeller and taken from his portfolio website. To define the correspondence points, I drew on the image of Anne, and labeled by 42 desired points, excluding the corners of the image. The points mark key features on the face includig eyebrows, eyes, nose, lips, and facial outline. From there, I used ginput to find the pixel location for each of these corresponding points. From there, to find the mean face between them, we run through each point in the corresponding points, and find the mean location between the two. With this new set of points, we run the built-in Delaunay function that triangularizes the points for us. Below are the images used for Anne and Meryl, image 1 and 2 respectively. Following s the sketch of points over Anne's face, and the average triagulation made from their two sets of corresponding points.

Anne portrait Meryl portrait
Point sketch Mean triangulation

Computing the "Mid-Way Face"

Moving on from the last step, we now have the correspondence points between the two images, the mean points between the two, as well as the triangulation of those mean points. With that, we compute the midway face by calculating the inverse affine matrix for each of the triangles, from each image respectively to the mean face. This affine transformation determines the pixel value of the midway face by referring to the original image. This ensures that every pixel in the output will have a pixel in the input images to referring back to when filling in the gaps. Below is the midway face calculated between Anne and Meryl.

Anne portrait Midway face Meryl portrait

The Morph Sequence

The morph sequence is essentially computing the midway face, but instead of using 0.5 as the weight, where we would equally weigh information from the two images, we change the weight at each iteration. By changing the weight at each iteration, we are effectively changing how much influnence each image has at a given frame. In the spec, we are told to have a total of 45 frames, where the first frame would be the first image, and the last image the second. Through each iteration, we increase (or decrease when going the other direction) the weight about 0.22, effectively 1/45. By keeping a list of these images through the 45 iterations, we can then generate a gif that shows the morph sequence from one image to another. The resulting morph output made me realize that the portraits were unfortunately not taken in the same position, so the facial morph is more drastic and less smooth than if the facial features were more aligned with each other.

Anne Meryl morph

The "Mean Face" of a Population

To find the mean face, we want to morph together all the images of the Danes dataset found here. As we are given all the datapoints with corresponding images in the dataset, we first find the mean shape of the population by finding the average of all the datapoints in the set. To generate the average face in the dataset, we take this average points list, a representation of the average face shape of the dataset, an morph each image into the average shape. To compute the average face, we take the sum of those morphed faces and divide out the number of faces that were involved in the sum, finding the average of all the morphed faces, giving us the mean face of the dataset. Below is the mean face of the Danes dataset. The mean face looks very male as the dataset had a 30:7 male to female images, so male features dominated the mean face.

Danes mean face

Below are images morphed into the mean face. Images on the left are original images in the Danes dataset, and the right image is their morph with the mean face.

Man original Man mean
Woman original Woman mean