CS 180 Project 3: Face Morphing

By Ediz Ertekin Jr.

Introduction

This project explores how to produce a "morph" animation between two faces. We will also have to compute the mean of a population of faces and extrapolate from a population mean to create a caricature of myself. I know in the instruction is said to apply your own face to someone elses however, when I saw the example picture of George Clooney it made me think about how people say my dad has some resemblance to him so I thought it would be fun to warp him with George Clooney. However, I do apply a warp to myself in the bells and whistles section.

Part 1. Defining Correspondences

In the first part of this project I manually selected correspondences points using the tool given in the instructions between the two input images and used Delaunay triangulation to create a triangular mesh.

Babacim mesh
Ediz Ertekin Sr. (Keypoints & Triangulation)
George Mesh
George Clooney (Keypoints & Triangulation)

Part 2. Computing the "Mid-way Face"

The next portion of this project involved computing the mid-way face between my dad and George. After computing the key feature points and triangulation, I compute the average points between the two images with the equation: avg_pts = (imA_pts + imB_pts) / 2. I then compute the Delauney triangulation on the average points. The next step was to generate affine transformations between the average points and both my dad and George. I then computed the inverse of the affine transformation as recommended in our lecture slides, and then apply a warping function on each image using its inverse affine matrix. The last step is to average the warped images.

Ediz Sr.
Ediz Ertekin (AKA Babacim)
Baba Clooney
Baba Clooney
George Clooney
George Clooney

Part 3. The Morph Sequence

For the third part of this project we had to create a morph sequence. I used the same method from part 2 to generate the mid-way face with a range of weights from [0,1] with 40 frames. I found a library called imageio that allowed me to input a list of the morphed images to generate a gif. I appended additionally frames of the final frame in order to have the image persist.

Morph

Part 4. The "Mean face" of a population

For the fourth part of this project, I computed the "mean face" of the Danes dataset, which consisted of 37 danish people, including 7 women and 30 men. This part of the project to quite a bit of time due to parsing the data. I began by importing all of the file names from the data folder. I then split the files into ".bmp" and ".asf" files which corresponds to the photos and their key points. I then created a custom parser in order to extract the (x,y) coordinate pairs for the key points of each photo. In order to keep things organized, I created a dictionary where each key is the path name to a photo and its value is the list of key points pertaining to that photo. I then had to scale the key points by the height and width of each photo. I then computed the average points across all key points in the dictionary in order to compute the average shape. Below are four examples of this.

female dane
Example 1
female dane warped
Warped
male dane
Example 2
male dane warped
Warped
male dane
Example 3
male dane warped
Warped
male dane
Example 4
male dane warped
Warped

I then computed the average face of all the images in the Danes dataset. Below on the left, I took the subsection of female Danes and computed the average face, in the middle is the average face among the whole dataset, and on the right is the average face of all the Danish Men.

Female Dane
Average Female Dane
Neutral Dane
Average Dane
Male Dane
Average Male Dane

Next I took the average Female Dane and warped my face in the average females geometry. Overall I do not think I would look good as a Female Dane. Below I am showing the aligned version of my original selfie, the average female Dane. Then I applied my Geometry to the Female Dane and her Geometry to myself.

Selfie
Ediz Ertekin Jr.
female dane aligned
Average Female Dane
monster 1
Ediz with Female Avg Geometry
monster 2
Female Avg with Ediz Geometry

Part 5. Caricatures: Extrapolating from the mean

For the fifth part of this project I created caricatures of my face based on the points of the average female Dane. I was able to slightly alter my morph function inorder to account for an alpha variable that is used to interpolate the triangles from the Delaunay computation. Although in order to create the caricature I had to pick alpha variables outside of the standard [0,1] range. What this means is that the resulting image would either amplify my face's features (alpha = 1.5) or amplify the average female face's features (alpha = -0.5).

Caricature with alpha = -0.5
alpha = -0.5
Caricature with alpha = 1.5
alpha = 1.5

Bells and Whistles

For my bells and whistles I changed my gender of my face using a average female asian face from the internet. I aligned the two images and applied the various morphing transformations including applying only the shape, only the appearance, and both the shape and appearance.

edo aligned
Ediz Ertekin Jr.
female photo aligned
Average Chinese female
edo aligned
Ediz with Female Shape
edo aligned
Ediz with Female Appearance
female photo aligned
Ediz with Female Appearance and Shape