# Face Morphing (CS 194-26 Fall 2018 - Project 4)

## Overview

This goal of this project was to produce smooth morphings between images of people's faces. Along the way I computed the mid-way Face between my friend Nick and I, created a morph sequence between our faces and back, calculated the mean face from a dataset of 100 Brazilian faces, and used that mean face to create a caricature of my self - highlighting my most un-Brazilian characteristics. Finally, for my bells and whistles I created a morph sequence music video featuring the Brazilian soccer national team, as well as turning myself into a Cambodian Female.

## Part 1: The Mid-Way Face

In the first part of the project, I wrote a function to define correspondence points between Nick and I's faces. I used 28 points at various key locations (i.e. eyes, ears, mouth, nose). Note that prior to this step I used the image aligning code from project 3 to make sure my images had the same shape and general alignment. I then used Delaunay triangulation, averaging mine and Nick's, to create "mid-way" triangles. Our faces were then warped to the mid-way triangulation using an affine transformation function I wrote, and afterwards our appearances (pixel values) were then also averaged - thus giving our Mid-Way Face, as shown below. It should be noted that glasses in general don't work very well for face morphing as they are a binary feature, not continuous as is desirable. Unfortunately I have no pictures without glasses.

 Ivan Mid-Way Face Nick

## Part 2: Morph Sequence

I then wrote a function to produce a warp between Nick's face to mine (and back), using the same methodology as in part 1, but this time looping over 45 weighting factors between 0-1, creating a smooth transition between the 2 faces. The result is shown below.

 Ivan-Nick Morph Sequence

## Part 3: "Mean" Face

For the 3rd part of the project, I used the first half (2 sets of 100 out of 200 Brazilian faces, half straight faced, and half smiling) of the faces FEI Face Database. I computed the average face of the population as shown below.

 Mean Face of 100 Brazilians

Here are 2 examples of faces from the FEI dataset transforming into the mean face and back. Notice that the #11 is fairly close to the mean face so there is little change in appearance, while #24 is more of an outlier due to age, thus his "more average" face appears shifted 10+ years younger (as the mean of faces in the database is far younger).

 #11 of the 100 Brazilians Making #11 more "Brazilian" Morph Sequence #24 of the 100 Brazilians Making #24 more "Brazilian" Morph Sequence Original Me Perhaps Brazilian me is better at soccer? Morph Sequence

A more Brazilian me appears to have a smaller forehead, nose, smile and a rounder face. The jury is still out on whether or not these changes will have an impact on my ability to kick a ball.

## Part 4: Caricatures

I noted what features would make me more Brazilian at the end of the previous section, what if I were to go in the other direction, and extrapolate / highlight these differences to create a caricature of me? Would I have a larger forehead, nose, smile and sharper face? In the images below, alpha indicates the weight given to the added vector away from the Mean Brazilian Face.

 Original Me alpha = 0.2 alpha = 0.5 alpha = 0.8 alpha = 1

## Part 5: Bells & Whistles

### Morphing Music Video on a Theme

Keeping in line with the Brazilian Theme of this project, enjoy the 2014 World Cup Brazil Squad's faces morphed into one another to the best World Cup song ever, courtesy of Shakira.

Note that the face morph doesn't handle huge hair changes very well. There are jarring discontinuities between Neymar -> David Luiz and Willian -> Paulinho, but within the giant afro Brazilians transformations are very smooth!

### Change of Gender & Ethnicity

I've always wondered what I'd look like if i was born a Cambodian Woman...

 Original Me Mean Cambodian Woman Shape Warp Appearance Warp Cambodian Woman Me

Note that my original colour is slightly lighter and my head shape longer and sharper than the average Cambodian woman. Thus the warp darkens my skin slightly and rounds my face, among other small changes.

Conclusion: If I can't be a Brazilian soccer player, then I think I'll stay as a Thai male.