Face Morphing

Hand with an eye in the palm

Overview

This project is all about faces, particularly morphing faces. To morph faces we need to have some points on our images that correspond to one another, like eyes to eyes, eyebrows to eyebrows. With this stepping point we can create animations that morph between two people, change gender, ethnicity, and other traits.

Defining Correspondences

To make faces morph well, we need to make sure that one they are somewhat aligned, and two, that there are some points that correspond to eachother. These points should be on key features, most notably the eyes, mouth, eyebrows, and silloutte of the face. I used a previous students website to create correspondences between two pictures. Who better to morph into one person than me and my girlfriend Colleen.

camera d/dx
Me
camera d/dy
My lovely girlfriend Colleen
camera d/dx
Points on my face
camera d/dy
Points on her face

With these points I created a triangulation using Delaunay triangulation. However we should only use a single triangulation for the rest of the steps. So I computed the average of my points and Colleens points and used that from this point onward, we can see this average triangulation below.

camera d/dx
My triangulation
camera d/dy
Colleens triangulation

Computing the "Mid-way Face"

A midway face is both of our faces warped to the average shape of our points. The most important step is warping, for each triangle we can calculate an matrix that corresponds to an affine transformation from our shape to the average shape. Then we can compute the inverse of the matrix, to find a 1 to 1 correspondance between my pixels and the output images pixels. I used skimage.draw.polygon, which takes 3 points of a triangle and creates a mask, this allows me to transform one triangle at a time. Below are both images morphed to the average shape.

camera d/dx
Me warped to the average shape
camera d/dy
Colleen warped to the average shape

Then we can cross disolve the images, giving the illusion of a single person.

Blurred
Mid-way Face

The Morph Sequence

Now we can compute a morph sequence by warping each frame to a weighted average of the two points. At time 0 its fully my face and my face shape, and at time 45 its fully Colleens face and her shape, and at the mid-way, its the midway face.

morph gif

The "Mean face" of a population

Now we want to start leveraging the power of averaging to get some cool effects. I used the danes dataset which has several images of Danish people which I will use in the following part. For each image they had some set of corresponding points, which I averaged together to get the "average shape of a Dane". Below I have warped a couple of danes to the average shape.

Derek and Nutmeg

taj
Example 1
sharpend taj
Example 2
taj
Example 1 warped
sharpend taj
Example 2 warped

Now we can average together all the images to create, "the most average Dane".

morph gif
Average Dane

We can then warp my own face into the average dane, and vice versa to create a very uncanny image.

morph gif
Me (again)
taj
Me to average Dane
sharpend taj
Average Dane to me

Caricatures: Extrapolating from the mean

We can create Caricatures of myself by using an alpha value that is greater or less than one when averaging. Below I've created a caricature of me as a Dane, and me as myself.

taj
Me with my own features exaggerated.
sharpend taj
Me with exaggerated Danish feautres

Bells and Whistles (Gender and Ethnicity)

I found an image online of the average Filipino woman, considering Colleen is also Filipino I thought this would be an interesting combo. I created a correspondance between me and the average, and morphed me to her shape, morphed her to my shape and cross dissolved, and morphed me to her shape and cross dissolved.

taj
Me (yet again)
sharpend taj
Average Filipino woman
sharpend taj
Me with just the shape of the average
blurred
me with appearance of average
blurred
Me with the shape and appearance of the average