# CS194 Project 4: Face Morphing

### Jacky Tian

##### Overview

Face morphing is exactly what it sounds like - an animation of one face being "morphed" into another. With two images, each frame of our animation consists of a different proportion of each image. As one proportion rise, and the other falls, we get this animation effect, of one face being morphed into another. Essentially, this is made possible through some linear algebra and precise mapping.

In summary, these were the few steps involved: 1. Use matplotlib ginput to select key points on each face. This included the eyes, mouth, nose, ears, hairline, etc. 2. Cross dissolve according to the proportion passed in, and create triangles from the points using Delaunay. 3. Warp each triangle to the corresponding triangle in the other image, ensuring points are mapped evenly and accordingly. The reason this works is because these triangles are going through an affine transformation, and their neighboring triangles that share a border will go through the same, non-conflicting transformation as well. 4. Take varying proportions of each resulting warped image, and overlap them, to create a morphed image. 5. Line up images back to back with increasing proportions, in order to create an animation effect.

##### Computing the Midway Face

Using the algorithm, I computed the midway face, a 50-50 split between the shape and features of the two images. It isn't perfect, but as a frame in an animation, it is hardly noticeable.

##### Morph Sequence

I created a gif from combining 46 frames of the morph, each having an equally distanced proportion from the previous.

##### Mean Face of a Population

From a public set of danish faces, I computed the average face, by following my outlined approach, but instead taking one over the number of images as each proportion.

Warping my face and the danish mean into each other:

Midway face of me and the Danish mean:

##### Caricatures

I computed caricatures by extrapolating from the mean face. Now, instead of taking 50% from each image, I might produce the animation by going from 100% of an image to 200%, which emphasizes the affine transformations by roughing the edges even more.

##### Bells and Whistles

I attempted to morph myself into a girl by doing just the shape and appearance. This was slightly more challenging as the opposite gender had longer hair and different facial compositions, which made morphing a lot more bumpier.