CS 194-26 Project 4

Face Morphing

Completed by Alex Krentsel

Description

For this project, we focused on morphing faces. To morph a face, we first take two images of faces and crop and align them such that they more-or-less overlay each other. We then label both faces with corresponding points (for example, on the eyes, nose, along the mouth, and outlining the face and hair shape). Finally, to morph one face into the shape of the other, we break the image into triangles using the points we labeled earlier, and morph each individual triangle in the original image to its corresponding triangle in the new image (in this case, using the triangles in the second set of points).

We morph from a single triangle to another triangle by applying an affine transformation matrix. We calculate this matrix by setting up a system of equations with 6 equations to solve for 6 unknowns (a, b, c, d, e, and f in the affine transformation matrix). Then, for inverse warp, we take each point in the new image and apply the inverse of the affine transformation to it to get where the pixel value should come from in the original image. We interpolate float values.

We can do this in repeated steps to create a face-morphing animation that shows the transition from one face to another.

Midway Face

Face 1 Face 2 Midway Face
On the left is face A (my face). In the middle is face B (Nicole's face). On the right is the midway morph of our two faces.

Morph Sequence

Applying the same algortihm as used above but instead making many smaller steps, then combining the images together into a gif produces the following result, featuring a cool morphing effect: Alex2Nicole

Mean Face of a Population

I took the FEI face dataset, which contains 200 face that are already aligned, cropped, and annotated. I computed the average face in the dataset along with the average face geometry.

Original Face 0:
Midway Face
Original Face 0 warped to mean:
Midway Face
Original Face 1:
Midway Face
Original Face 1 warped to mean:
Midway Face

Average Face

Midway Face

My face warped into average geometry

Midway Face

Average Face warped into my geometry

Midway Face

Caricatures

We can use our above techniques to produce a caricature of someone's (me) face. To do this, we first take the subject's face and subtract the mean face from it. This difference gives us the deviation from the mean of the subjects face, which is what makes their face "theirs." Then, we take this differenc,e multiply it, and add it to the average to get a caricatured version of the person's face. Here are some sample resukts:

Caricature of my face morphing the mean face

Midway Face

Caricature of my face morphing my face

Midway Face

And finally, just for fun, I cranked up the caricature even more to get this comically bad caricature:
Midway Face
Clearly I have a large chin, as the caricaturing algorithm has pointed out to me. As noted in class, if we crank up the weight too high, the image just starts to break and no longer looks realistic.

Bells and Whistles

Face-morphing Video of Students in the Class

I banded together with some fellow students to create a face-morphing video. We worked together to create the video, and uploaded it to YouTube. See it here!

Face-morphing Music Video - Classical Composers

I play a lot of violin in my free time, and am pretty into classical music, so I decided to make a classical-music themed music video. I took portraits of 6 famous composers - Bach, Haydn, Mozart, Beethoven, Mendelssohn, and Chopin - then aligned and annotated their faces. Then I put them in chronological order and created a morph sequence out of them that cycles around, and put some classical music in the background. Here are the composers on their own:
Bach Haydn Mozart Beethoven Mendelssohn Chopin

Here is a GIF of the resulting animation:
Composer Animation
Here is the resulting music video:
Click me to see!

Change Ethnicity

I found the average male Ethiopian face online, annotated it with points along with my face, and then using this set of points, made my face look more asian.

This was the average Ethiopian face:


This is my face (as a reminder) for comparison:


After using the above techniques and playing with my face some more, these were the results:

On the left is just the shape morphed, in the middle is just the appearance, and on the right is both morphed



I did this again but this time using the average female face to make myself look more femenine. Here was the average female face:


Here are the results:

On the left is just the shape morphed, in the middle is just the appearance, and on the right is both morphed