CS 194 Project 3: Face Morphing


Jamarcus Liu, cs194-26-adh

Overview

In this project, I computed the average face of me and my friend David Lyu’s and created an animated gif to showcase the morphing process. Also, extending the same technique, I computed the mean face of 40 people in this dataset (FEI Databases), and created caricatures of myself.

Part I. Computing the "Mid-way Face"

In this part, I computed the mid-way face between mine and my friend David's. The input photos were taken on a plain background with similar depth and lighting. I manually selected 79 corresponding features points from both images using plt.ginput, and used one set of points to create a Delaunay Triangulation. Then, I defined a function to compute the affine transformation matrix for pairs of triangles in two images. Using this function, I was able to conduct inverse warpping for each triangle on the output by averaging the color intensity of corresponding pixels from two source images.

Me My friend David Lyu Mid-way Face
Original Image Feature Points Triangulation

Part II. The Morph Sequence

In this part, I extended the face warpping function defined for Part I and created a sequence of morphed faces with different input ratio t. Specifically, t iterates over all values in np.linspace(0, 1, 46) and created 46 images with the first one as my face (image1) and last one as David's face (image2). Then, I used Photoshop to create animated gifs from the frame images with a display time of 1/30 seconds per frame.

Morph Sequence

Part III. The "Mean face" of a population

In this part, I computed the "mean face" of all faces images in FEI Databases. There are 33 male and 7 female computer scientists featured in the dataset.

Again, I changed the face warping function defined in Part I a little so that it can compute mid-way face of more than 2 images. Here are the average faces of Danish computer scientists.

Average Face Average Male Face Average Female Face

Here are some example faces mapped to the average geometry. This can be done by setting the shape factor to 1 (average) and the color factor to 0 (original color).

Face 1 Face 6 Face 7 Face 8 Face 9
Original Face
Morphed Geometry

Here are the results of morphing my face to the average geometry and morphing the average face to the geometry of my face.

Original Face Morphed Geometry
Me
Average Face

Part IV. Caricatures: Extrapolating from the mean

In this part, I extrapolated from the average faces I created in Part III and created caricatures of myself. Here, t is the shape factor in the face warpping function. t = 1 correponds to my original image; t > 1 highlights the difference between me, and the average face whereas t < 1 morphs my face towards the average face.

Original (t = 1) t = 1.25 t = 1.5 t = 1.75 t = 2
Original (t = 1) t = 0.75 t = 0.5 t = 0.25 t = 0

Bells and Whistles Part I: Change Gender and Ethnicity

I used the gender-specific average faces for Danish computer scientists and morphed my face to then. This is probably what I would look like had I been born half-Chinese, half-Danish and had I pursued a career in computer science.

My Face Average Male Face Morphed Geometry Morphed Color Morphed Face

Here is the process but with average female faces.

My Face Average Female Face Morphed Geometry Morphed Color Morphed Face

Bells and Whistles Part II: Face-morphing Music Video

Credit to Zixian Zang for organizing this! If the embedded video fail to work, here is the link.