CS 180 Project 3 –– Face Morphing

Aarav Patel

Overview

Project 3 is an exploration of the following: 1) defining good points of correspondence between two faces (based on primary features like eyes, nose, mouth, etc.), 2) computing facial geometries (Delaunay triangulation), 3) warping faces into different geometries, 4) creating smooth morph seqeunces, 5) computing the mean face of a population, and 6) extrapolating from the mean face of a population to create caricatures.

Part 1. Defining Correspondences

I decided to morph my little brother's (Ayan) face into my (Aarav) face. I first had to label points in both images to define the correspondence.

Ayan

OG Cameraman

Aarav

dx cameraman 1

Annotated Ayan

OG Cameraman

Annotated Aarav

dx cameraman 1

I then averaged the defined points in both images to arrive at a mean correspondence. I subsequently used Delaunay triangulation to define the mean geometry.

Ayan with Mean Triangulation Map

OG Cameraman

Aarav with Mean Triangulation Map

dx cameraman 1

Part 2. Computing the "Mid-way Face"

I first wrote the computeAffine function to generate the affine transformation matrix that maps the target geometry (in this case, the mean geometry) to the source geometry. Then, for each of the input images (Ayan and Aarav), I warped its geometry to the mean geometry. I achieved this using the following method: 1) I created a polygon mask for each of the triangles in the mean geometry, 2) I computed the affine transformation matrix to map the triangles from the mean geometry to the source geometry, 3) I applied this transformation to sample from the corresponding location in the source image, 4) I cast the coordinates to integers as this yielded efficient and sufficient results (and was approved by course staff on EdDiscussion). After generating images of Ayan and Aarav with the mean geometry, I averaged them to get the mid-way image.

Ayan with Mean Geometry

OG Cameraman

Aarav with Mean Geometry

OG Cameraman

Mid-way Image

OG Cameraman

Part 3. The Morph Sequence

Here, I generated a .gif of a morph sequence with 90 frames at 30 fps. Each frame is a differently weighted average, starting with the original image of Ayan and ending with the original image of Aarav. The .gif cannot be viewed on page.pdf–– please use the site to view it.

Morph gif

Part 4. The "Mean face" of a population

For this part, I choose to use the IMM Face Database ("Dane dataset"). I first parsed all the .asf files and computed the average correspondence for males, females, and both together. I then computed the average geometry for each of these groups. I then warped all the males to the average male Dane shape, all the females to the average female Dane shape, and finally the entire dataset into the average Dane shape. Note that there were far more male samples in the dataset, thus the average shape for the dataset skews towards the average male Dane shape.

Original Male Dane

OG Cameraman

Male Dane Warped into Average Male Dane Shape

dx cameraman 1

Male Dane Warped into Average Dane Shape

dx cameraman 1

Original Male Dane

OG Cameraman

Male Dane Warped into Average Male Dane Shape

dx cameraman 1

Male Dane Warped into Average Dane Shape

dx cameraman 1

Original Female Dane

OG Cameraman

Female Dane Warped into Average Female Dane Shape

dx cameraman 1

Female Dane Warped into Average Dane Shape

dx cameraman 1

Original Female Dane

OG Cameraman

Female Dane Warped into Average Female Dane Shape

dx cameraman 1

Female Dane Warped into Average Dane Shape

dx cameraman 1

I then averaged all the results from each group to arrive at the average male Dane face, average female Dane face, and average Dane face (which skews towards the average male Dane face due to dataset imbalance).

Average Dane Male Face

dx cameraman 1

Average Dane Female Face

dx cameraman 1

Average Dane Face (Skewed)

dx cameraman 1

I then warped my face into the average Dane face and vice versa.

Aarav Warped to Dane

dx cameraman 1

Dane Warped to Aarav

dx cameraman 1

Part 5. Caricatures: Extrapolating from the mean

To create caricatures by extrapolating from the average Dane face, I set the warp_frac parameter of morph to 1.5 (exaggerate the average Dane's features) and -1.5 (exaggerate my features).

warp_frac = 1.5

dx cameraman 1

warp_frac = -1.5

dx cameraman 1

Bells and Whistles

For this part, I choose to change my ethnicity to Chinese. I used the web to find an image of the average Chinese Male's face.

Average Chinese Male Face

dx cameraman 1

Changing Only My Face Shape

dx cameraman 1

Changing Only My Appearence

dx cameraman 1

Changing Both Shape and Appearence

dx cameraman 1