Project 3: Face Morphing

Overview

In this project I create a "morph" animation of my face into someone else's via a continuous morph of the image shape and cross-dissolve of the image colors. I proceed to compute the average face of a population (the IMM Face Database) and use it to extrapolate features of my own face and create caricatures of my features.

Part 1. Defining Correspondences

I crop and rescale a beautiful portrait of notorious American rapper Kanye "Ye" West (taken by Martin Schoeller) and a beautiful image of myself (taken by myself) to the same image size, attempting to match the facial size and aspect ratio to the best of my ability. I then used an online tool to manually label a total of 45 correspondences between the two images. These correspondences represent the locations of key features on each image that should map to each other.

After labelling the correspondences, I compute a Delaunay triangulation of each face to be used for morphing.

Correspondences and Delaunay Triangulation (45 points)

Ryan
ryan_delaunay.png
Kanye "Ye" West
ye_delaunay.png

Part 2. Computing the "Mid-way Face"

We can compute the mid-way face by first computing the average shape (averaging each pair of correspondences in each image), warping images into that shape, and averaging the colors together by cross-dissolving.

In order to warp the images, I compute the inverse of the affine transformation matrix between each triangle in the original image and the corresponding triangle in the average shape. I then perform inverse warping with this matrix, performing bilinear interpolation in the case that the inverse transformation warps values between pixels, and iterate over all triangles to produce the warped image.

Ryan
ryan_ye_small.jpg
Mid-way Face
ryanyemidway.png
Kanye "Ye" West
MS_West_Kanye_CloseUp_small.jpg

Part 3. The Morph Sequence

Using similar methodology to creating the mid-way face in the previous part, we can create a continuous morph from one image to the next by letting the shape warping fraction (e.g. 0.5 for mid-way) and cross-dissolve fraction vary with time. I create a gif of 100 frames each direction of this continuous morphing process, with 25 ms per frame, over a total of 5 seconds. Each fraction was scaled linearly with time.

ryany.gif

Part 4. The "Mean face" of a population

I first compute the average shape of Danes in the IMM Face Database (consisting of 240 images of male and female Danes) by first parsing the correspondences in the database, then taking the average in order to get the mean shape.

Below are examples of images from the data set, followed by what their faces look like after being warped to the average Dane face.

1-1m.jpg
dane1_unwarped.jpg
12-1f.jpg
dane2_unwarped.jpg
40-1m.jpg
dane3_unwarped.jpg
30-1f.jpg
dane4_unwarped.jpg
dane1.png
dane2.png
dane3.png
dane4.png

After warping to the average face shape, I take the mean of all the images to get the mean face for all of the images in the dataset.

avg_dane.jpg

Next, I warp my face onto the average shape of Danes, and warp the average face onto my geometry. It looks a bit strange since the aspect ratios for our faces are quite off vertically, and the correspondences in the Dane dataset do not include forehead and hair.

Ryan warped onto Dane Shape
ryan_dane_warped.jpg
Dane warped onto Ryan Shape
avg_dane_warped.jpg

Part 5. Caricatures - Extrapolating from the mean

Extrapolating my face shape from the Danish mean shape and vice versa, I can create caricatures of myself. The formula I use for extrapolation is p + alpha*(q - p), where p is a point on my face, q is a corresponding point on the population mean, and alpha is a variable scalar. alpha>1 corresponds to emphasizing the shape/geometry of the population mean, and alpha<0 corresponds to emphasizing my own geometry.

alpha=1.5
ryan_dane_warped_15.jpg
alpha=-1
ryan_dane_warped_neg.jpg

Bells & Whistles

Changing Gender

I found an image of an averaged Taiwanese female face from this website and experimented with using the image morphing techniques described above. I first morphed my facial geometry onto that of the average Taiwanese female, then compared it to cross-dissolving the images without morphing the geometry. Afterwards, I tried morphing both appearance and shape, and I believe it looks the best. Honestly, if I were real I would date me.

Ryan
ryan_female.jpg
Average Taiwanese Female
averagetaiwanesefemale.jpg
Morphed Shape
ryan_dane_warped_fem.jpg
Both
ryan_fem.jpg
Cross-Dissolved
avg_female_warped.jpg

Roommate Morphing Music Video

I made an image morphing music video of my roommates and I that can be found below:

Principal Component Analysis

We can reshape the image matrices in the Danes dataset as vectors, and perform Principal Component Analysis on the matrix of all of them to obtain the principal components for the dataset. I choose to do this after geometrically reshaping the faces in the images, so that the resulting vectors mostly contain color information. A picture of the top 16 principal components is displayed below, from highest to lowest left to right top to bottom.

dane_pca.png

I proceed to reconstruct some of the images from the dataset using 16 principal components and 100 principal components, reconstruct the average face in the basis, and also attempt to reconstruct my face in the basis.

1-1m.jpg
dane1.png
12-1f.jpg
dane2.png
40-1m.jpg
dane3.png
30-1f.jpg
dane4.png
dane1_re.png
dane2_re.png
dane3_re.png
dane4_re.png
dane1_re100.png
dane2_re100.png
dane3_re100.png
dane4_re100.png
Average Dane
avg_dane.jpg
Reconstruction from 16 Principal Components
avg_dane_re.png
Reconstruction from 100 Principal Components
avg_dane_re100.png
Ryan warped on to Average Dane Shape
ryan_dane_warped.jpg
Mapped onto 16 Principal Components
ryan_dane_re.png
Mapped onto 100 Principal Components
ryan_dane_re100.png

As can be seen above, more principal components captures more of the color and details. The details seem to be captured on the edges first, which makes sense as there is a lot of variation in the center where the faces are that makes it difficult to capture. My face also is not represented well by the basis, but this is partially due to it being so far out of distribution compared to the other faces.