### Project 4: Face Morphing

#### CS 194: Computational Photography

##### Overview

In this project, we explored affine transformation matrices to morph the features of two face images. We first define corresponding points between the two images, then set up a Delanuay triangulation of the average points between the two images. Next we compute the respective affine transformation matrices to map triangles from the averaged points to the original images. We used this to determine which pixels from the source images should be used where in the target mid-face image. This method is also used in morph sequence and computing the mean face of a population.

##### Defining Correspondences
Using Python's g-input function, I defined 22 corresponding points between two images. Next, I computed the average value of each point between the two images and used these averaged points to compute a Delanuay triangulation. Below we can see the triangulation applied on Obama's and Clooney's face.
##### Computing the Mid-Way Face
For all points within a triangle, I perform an inverse warp from the averaged image to the source image. I also used scipy's interp2d function to help interpolate color value in the case where the x, y coordinates were floats and not integers.
##### The Morph Sequence

To create the morph sequence, I used 45 frames where the first frame corresponds to the source image of Barack Obama and the last frame corresponds to the target image of George Clooney. At each timestep, which is incremented by a step of 1/45, blahblah are weighted by a warp fraction and the pixels are weighted by a dissolve fraction.

##### The Mean Face of a Population

Given the pre-annotated points in the Danes images, I computed the average value of each point across all the images. I used the same triangulation method as above and computed the affine transformation weighted by 1 / number of images to obtain the mean face of a population.

Here are a few examples of some Danes warped to the average Dane face.

##### Caricatures: Extrapolating from the Mean

To exaggerate the features of the average Dane's face computed above, we extrapolate points from both George Clooney's and the average Dane's face with respect to a specific alpha. I used the same morphing technique as in Barack Obama and George Clooney mid-way face. Note that when warping Clooney's face to be more like his own face, it slims dow and becomes rectangular shaped. However, when warping Clooney's face to be twice as similar to the features of the average Dannish man, his face is very round.

##### Bells and Whistles

I decided to morph my face into the average African-American woman's face. Similar to previous parts, I had to align the images and select corresponding points.