For Fall 2024, I am taking an image processing class. One assignment involves face morphing without neural networks! Here’s an example:
In this project, I also created intermediate morphs, caricatures of myself, and computed the average face of a population.
Here’s an amazing example of super-smooth face morphing to music.
Part 1: Source Images and Feature Extraction Link to heading
These are my source images:
First, I used the dlib
library to extract facial landmarks from both images. Then, I computed the halfway points for each landmark pair to determine the morph points, and applied Delaunay triangulation to create a triangle mesh for the morph.
Part 2: Midway Face Calculation Link to heading
I computed the “midway face” by applying affine transformations to morph each triangle in both images toward the midpoint shape. Here is the 50/50 blend between the two images:
Part 3: Morph Video Link to heading
To create a morphing animation, I varied the weights from 100% one image to 100% the other:
output = image1 * alpha + image2 * (1 - alpha)
This generates a smooth transition from one face to another. Here are some examples:
Part 4: Average Face Calculation Link to heading
I computed the average face from a Danish face dataset by averaging each landmark position across faces.
Here’s the average face shape of a Dane with feature points overlaid:
And here’s the computed average Danish face:
Next, I morphed several individual faces from the dataset into the average Danish shape:
Here’s my face warped to the average Danish face shape:
And here’s the average Danish face warped to my face shape:
Part 5: Caricature Link to heading
By extrapolating away from the average Danish face shape, I created a caricature of myself. Setting the weight to -1 (instead of within [0, 1]) exaggerates my unique features:
Extra Credit Link to heading
Here’s a video of me morphing from a kid to 21 years old, synced to music.