# CS 194-26: Fall 2020 Project 3: Face Morphing Megan Lee

## Overview

In this assignment, I produced morph animations of my face into someone else's face, computed the mean of a population of faces, and extrapolated from a population mean to create a caricature of myself.

## Defining Correspondences

First, I manually defined 40 pairs of corresponding points on the two images by hand (one point for my eye, one point for Joyce's eye, and so forth). Then, by averaging the corresponding points, I was able to obtain one set of mean points from our two faces.

I intially did not include the four corners of the photo, but then added them in later as I noticed the morphing excluded the undefined areas.

After I had the points defined, I needed to provide a triangulation of the points that can be used from morphing. I decided to use the Delaunay triangulation, as it avoids overly skinny triangles, on the set of mean points.

## Computing the "Mid-way Face"

After obtaining the points for my face and Joyce's face, I determined a mean "mid-way" face for both of us by taking the average of each point I defined on our faces. Then, I computed an affine warp for each triangle in my initially defined correspondences into the new, mean shape.

For this affine warp, I used simple linear algebra to obtain a transfomation matrix, and multipled each triangle by that transformation matrix.

Once I've obtained the warped triangles, I added the results back, averaging the colors through a process called cross-dissolve. I illustrated the overall process below. As you can see, I first warped each image into the mean shape, then cross dissolved them together.

## Morph Sequence

I was able to create this cool morphing sequence using a slightly modified version of the algorithm used in the previous parts. Instead of taking the average (warp fraction 0.5), I computed 40 warping images with a warping fraction of 1/40. At t=0, we start with Joyce's face, and increment to end with my face at the end of the sequence.

## The "Mean Face" of a Population

Here, I computed the average face shape of the whole population or some subset of the population (e.g. all the girls or all the old/young/white/asian/blond etc.). I decided to choose to compute the average face of a happy Danish Computer Scientist. The dataset used came from Denmark's Computer Science faculty, and consists of 240 annotated monocular images of 40 different human faces in different expressions.

The gender distribution is 7 females and 33 males.

### Average Happy Danish Computer Scientist:

I thought the result of this was super interesting. We talked about how you can pretty much recreate any face with the faces of 200 other people, and by taking the "average" face of many different faces, we are able to get rid of a lot of the intricacies and uniqueness on the face that make each person unique, dulling it down to this almost perfect looking, symmetrical human. I also noticed that the resulting happy Danish Computer Scientist looks more male rather than androgynous, and that is because the dataset has a majority of male faces.

Some selected morph examples are shown below.

## Caricatures: Extrapolating from the mean

I was able to produce a caricature of myself by extrapolating from the population mean of the happy Danish Computer Scientist's face. I essentially just found the difference between the two images, multiplied it by a factor of x, and adding it back into the image of me.

This caricature really brought out the unevenness of my eyes and my very angular head shape.

## Bells & Whistles

I decided to create a morphing music video on TikTok of my family! I was able to get three generations to participate and I thought it was interesting to see how similar some of our features were. I converted the TikTok to a Youtube video for your viewing pleasure below.

I also participated in the class morph video, show below.

## Final Thoughts

This project was a lot of fun, and a lot of work. I really enjoyed seeing how similar my features were to my family's, and also found it super interesting how the mean face of a population smoothes out imperfections/uniqueness. There are some fun new filters on social media webpages like Instagram, TikTok, and Snapchat, and after this project I had a good idea on how they were made, especially the morphing ones!