Project 3: Face Morphing

CS 194 - Aivant Goyal

In this project we explored the concept of morphing two faces together by averaging face shape as well as face color.

To do this, We defined correspondence points on both faces, computed a Delanauy triangulation, and then calculated the Midway face shape. After that we cross dissolved to get an properly morphed image!

In this project I explored a few avenues of morphing, including morphing two faces together, creating an animation, finding the mean face of a population, and simulating what my friend might look like if he was a girl!

Part 1: Defining Correspondences

Using cpselect, a python package, I selected correspondence points on an image of both me and my roommate. I included as many points as possible as well as the corners of the image to get a good triangulation. After that, I computed a Delanuay triangulation for the both of us!

Original Triangulated

Part 2.1: Computing the “Mid-way Face”

In order to calculate the midway face, I followed the following steps:

  1. I calculated the midway “shape” of me and my friend’s faces by computing an average of the correspondence points and computing a Delanuay triangulation of the average
  2. For each triangle, I computed the Affine transformation matrix that would transform the triangle in the space of each picture to the midway shape
  3. I then used the polygon function to find all the points inside each triangle.
  4. For each triangle, I computed an inverse warp to find the corresponding points in the space of the original images
  5. Finally, for each triangle I cross-dissolved the points in each image to get the values for the triangle in the new, morphed image!

This is the result:

Me My Roommate Mid-Way!
Kathy Alison Mid-Way!

Part 2.2: The Morph Sequence

Repeating the same process but performing a weighted average when computing the average shape and the cross-dissolve and adjusting the weights, we can create an animated gif of a smooth morph!

In this gif, I made 50 frames and played them each for 1/20th of a second.

My friends Alison and Kathy:

Part 3.1: The “Mean face” of a population

Next, I used an existing image set and found the mean face amongst a large population of faces. I used this set of Danish Computer Scientists.

The images already had correspondence points marked. I used code shared on Piazza to parse the ASF files and then added 4 extra correspondence points to represent the corners. I then computed the average shape by taking the average of all the correspondence points.

Below are some examples of the scientists morphed onto the average face shape.

Original Morphed to Average of Gender

Averaging all the faces morphed onto the average face give us a “mean” face!

Mean Male Face Mean Female Face Overall Mean Face Mean Smiling Face

Part 3.2: caricatures: Extrapolating from the mean

We can make a caricature by extrapolating from the mean and giving the average shape a weight greater than 1!

Here’s an example of my roommate morphed with the mean face giving the mean shape a weight of 1.15 and my roommate’s shape a weight of -0.15.

I think the shape is a little bit off because the correspondence points on the danes don’t capture the shape of the head super well

Part 4: Bells and Whistles

Finally, I used the mean female shape to see what my roommate would look like as a girl!

Ruchir Mean Female Just Color Just Shape Both