# CS194-26 Project 4 - Face Morphing

## Part 1 - Defining Correspondences

For this part, I built a way to allow a user to define matching correspondences on two images at once. You can see a screenshot below:

The user first picks a point on the left, source image, and then picks the corresponding point on the right target image.

Now that we have the correspondences, we compute the average between the keypoints of both images, and use that average to create a triangulation of the keypoints.

## Part 2 - Midway Face

Now that we have the triangulation, we can compute the midway face. First, we average the keypoints to get the mesh for the midway face. Next, for every triangle in the midway face, we compute the affine transformations from that triangle to the corresponding source and target triangles. Using those transformations, we can then get the corresponding color values. We average the calculated source and target color, and we get our output image! Below is an example of my face midway-morphed to Ryan Gosling:

You can see the original images in Part 1.

## Part 3 - Morphing

We take part 2 one step further. Instead of averaging, we can instead do every ratio from 0 to 1, and create a morph animation from my face to Ryan Gosling’s face!

## Part 4 - Mean Face

Using similar face morphing ideas, we can also calculate the average human face. Using this dataset, we compute the average human face by morphing all of the faces to the average face shape. Here’s Mark Zuckerberg and Hillary Clinton warped to the average face shape:

Next, we average the color values, getting the average face:

I can also warp my own face to the average geometry, which looks pretty awkward…

Original:

My face, warped:

It looks a little nicer when you warp the average face to my face geometry:

## Part 5 - Caricatures

We can also extend our morph to create caricatures! You effectively morph your face with the average face, but using -1 as your ratio to accentuate your own face’s features. Here’s a caricature of my face:

## Bells and Whistles - Gender Bending

Again applying morphing, we can also gender bend a target portrait! The basic idea is that we compute the average male and female face, compute the difference, and add that difference to our target portrait.

Original:

Only shape:

Only color:

Shape and color:

## Bells and Whistles - Class Video

Check out our video here: