# Face Morphing

## Sandy Zhang (cs194-26-acu)

### Overview

In this project, we seek to create morphs from one face to another, using a combination of a geometric warp and a color warp. The geometric warp depends on annotating correspondences of facial features, whereas the color warp is essentially just a cross desolve of the colors of the two warped images.

### 1: Defining Correspondences

To create correspondences, I marked points on a face in a sequential order and returned the list of points for both images. I then calculate the average position for each point, and use this list of points to calculate the delaunay triangles to help triangulate the image.

### 2: Computing the "Mid-Way Face"

By using the correspondances defined in the previous part to calculate the "average shape" of the image, we can compute a midway face for both images by warping both images to the "average shape" using the inverse of the affine transformation that would transform the each triangle for the image to the corresponding triangle for average image and then averaging the pixel values of the resulting warped source and target images.

Sandy, Mom, and Sandy & Mom Mid-Way

### 3: The Morph Sequence

Similar to computing the "Mid-Way Face", we can also compute the morph sequence from a source image to a target utilizing similar affine transformations of our corresponding triangles. However, we now adjust a `warp_frac` and `dissolve_frac` for each image frame to determine the weights for each image while warping and dissolving. Thus, for a warp and dissolve_frac of 0, we simply get the source image and for values of 1, we simply get the target image. Each value in between helps us generate the smooth transition from the source to the target.

### 4: Mean Face

We can calculate the mean face of a population by aggregating the corresponding labeled points in the dataset and computing the average for the "mean shape". We can then warp each image into this "mean shape" using affine transformations as we did with the mid-way face and morph sequence. Then, by simply averaging the pixels for each warped-to-average image, we get our mean face. For this example, I computed the mean face for smiling Danish females! Notice that though the edges may be blurred, the face itself (which has been aligned using our points) still has fairly distinctive facial features.

Average Danish female, Danish females warped to average

Sandy warped to average, Average warped to Sandy

#### 5: Caricature

By adding taking the difference between the labeled points on the picture of me and the average Danish female back to the points on the picture of me, I can create a warp to this exageration of my features to create a caricature of myself. We can see here that relative to the typical Danish female, I have much smaller eyes and a much smaller mouth. We also see that my eyes tend to arch into a ^_^ face more!

#### Morph to Average Chinese Male

I decided to morph myself into the average Chinese male, which I found from the internet. This comprised of largely the same approach as that of the previous parts.

Original Images

Full morph, Shape-only, Appearance-only

#### CS Professor Music Video

I made a music video for the morphs of some of the CS Professors at Berkeley. I have included it as a gif below, but it can also be viewed here with audio!

#### Class Morph

I partook in a 23-person class morph video which can be viewed here (login: acu) Here was my portion of the morph