# CS194-26 Project 4

Face Morphing

by Kimberly Kao, cs194-26-aas

## Face Morphing

Morphing Algorithm:

1. Manually define the correspondence points of each image. Make sure to select the four corners of the image or the triangulation would not include the areas outside of the face!
2. Find the average of the two sets of correspondence points. Perform Delaunay Triangulation of this new set of points.
3. Now we have a list of target triangles. For each target triangle, we compute the affine transformation matrix to warp a source triangle to the target triangle. For each point in the target triangle (calculated by calling scipy's handy function draw.polygon), we apply the inverse affine transform to each point to get the source point. Since the source point could fall between points, we use interp2d to get the weighted average of pixel intensities. Finally, copy this interpolated value back into the target image.
4. Since we want 45 frames, define our step size to 1/45. For t=0..1, step=1/45, compute the average shape at t by following the equation imHalfway = (1-t) * im1 + t * im2. The midway face is the result of t=0.5, where we get exactly half of each image.

Morph 1: Two Danish scientists

Source

Target

Source with correspondence points

Target with correspondence points

Source morphed to midway face (t = 0.5)

Target morphed to midway face (t = 0.5)

Midway Face

Final Morph
(Hosted on imgur, so if it doesn't load, click to go directly to URL)

Morph 2: Me and Constance Wu

Me

Constance Wu

Final Morph
(Hosted on imgur, so if it doesn't load, click to go directly to URL)

## Mean Face of Danish Scientist Population

Implementation:

I used a dataset of 37 Danish scientists to produce the mean face of the Danish scientist population. First, I computed the correspondence points of the average Danish scientist by taking the average of all the correspondence points of each scientist. Then I warped each scientist into the average shape. Finally, I took the average pixel intensities of all the averaged faces to produce the final average Danish scientist face.

Results

07-1m Morphed Into Average Face Shape

08-1f Morphed Into Average Face Shape

The Average Danish Scientist Face

Me to Average Danish Scientist

Average Danish Scientist to Me

## Caricature

Implementation:

Taking the previously computed average Danish computer scientist's Face (call this A), I subtract the correspondence points of my own face (call this B) from the points of A to find the feature differences. We can then use these feature differences to produce a caricature by extrapolating from the mean using the equation: caricature_pts = A + alpha * (B - A), where alpha is greater than 1.

Results

Original

Alpha = 1.3

Alpha = 1.5

Alpha = 1.8

## Bells and Whistles

Changing Myself to a Dutch Woman

I found an image of the average Dutch woman and decided to change myself to her! Below are the results of 1) changing only my shape, 2) changing only my color, and 3) both color and shape. Each image was morphed/cross-dissolved at 50%.

Me

Average Dutch Woman

Me with 50% Shape

Me with 50% Color

Me with 50% Color and Shape

Morph

Time Capsule

Here is me at ages 5, 8, 14, and 21!