# CS196-26 Project 3

## Computing the "Mid-Way Face"

Before morphing my face into my friend's, we first compute the mid-way face between us two. First we pick corresponding points by hand in the same order for both pictures. Then we compute a triangulation on the average of the two sets of points and use the average triangulation for both sets. For each triangle in the triangulation, we get the corresponding 3 points making up that triangle for each set of points (6 points total) and compute the affine warp matrix from those 3 points to the 3 points making up the triangle. Then get all the points in the average face in the specific triangle and warp them using the affine matrix to get the corresponding points in the two original images so that we can use them to interpolate the color. Then we fill in the average image at those points in the current triangle with the interpolated color values we get from plugging in the warped points into the interp function generated from the corresponding original image and divide it by 2 (since it's the midway face).

## The Morph Sequence

Now we can compute a bunch of faces with varying degrees of morph instead of 0.5 and combine them all together in order to form a morphing gif. To generate these morphs we do the same thing as the mid-way face computation but instead of averaging the points for the shape and color we compute the values by multiplying the values of the first and second image by 1 - r and r respectively before adding them where r is the amount of morph from image 1 to image 2 (r = 0 just outputs image 1). The gif below is made using 51 frames.

## The "Mean Face" of a Population

Here we compute the average face over the Danish dataset provided. This is done by computing the average shape and color using all the photos instead of just two using the same method as the midway face.

Now we morph all of the individual faces in the dataset to the shape of the average face but still keep the color from the original image. Below are a few examples.

Here's my face warped to the average Danish shape:

And the average Danish person warped to my face shape:

As you can see my face and nose are bigger, my eyes are farther apart, and my mouth is smaller than the average Danish person.

I used a different picture for this section so that I could get the photo size/aspect ratios correct.

These were created by calculating the warp matrix using a specific shape instead of some average shape and then filling in the colors based on interpolating from only one of the photos instead of multiple for some average photo.

## Caricatures: Extrapolating from the Mean

Here's a caricature of my face made by exaggerating the differences between my face and the average Dane. I subtracted the average Dane out of my face to get the difference and then added the difference back into my original face to exaggerate them.

My face and nose are bigger, my eyes are farther apart, and my mouth is smaller, as expected.

## Bells and Whistles - changing my gender

Here's a photo of the supposed average Chinese man I got from Google Images:

me again:

me with the average Chinese male face shape:

the average Chinese male with my face shape:

me as a male (just a midway morph):