Project 3 - Face Morphing

Anderson Lam (3033765427)


For this project, we got experience with learning how to face morph. The performance largely depended on how well one chose their points (triangles) to match up with another shape's triangles.

Defining Correspondences

For this part of the project, we need to find corresponding points between two images. Or at least develop soem algorithm to do so. I ended up using a package someone built into Python called cpselect, although, I had to do some modifications as it only worked with an older version of matplotlib. I essentially just copied the source code and changed where there were errors in the code to get it to work. Below are my images and then the triangles that I plotted. I used the Delaunay algorithm for the triangles.

Below is Amy and Anderson (me) with our points

Computing the "Mid-way Face"

After plotting corresponding points, the next step is to basically calculate the midway image that will help us later create a morphing animation. In this case the warp_frac is only 1/2.

To calculate this we need to find the affine transformation matrices for each triangle in our image 1 shape to our midway image shape. We then loop for each triangle and apply the affine transfomration. After, we create an interpolation function that will help with transform and smooth out the points future. I created three interpolation functions in order to preserve the colors and then stacked them together.

Note: The shapes below are weird since our heads didn't align and we both have our heads angled.

This is plot with the average shape between Amy and I over my face. We can see how the shape needs to transform.

Amy with warped to midway

Anderson with warped to midway

Here is the midway

George and Obama

Face structures are morphed below

Complete midway image

The Morph Sequence

The next part is to do moprhing! And this part really is simply taking the code we used for the midway, but instead of only doing mean, in this case: im1_pts * 1/2 + img2_pts * 1/2, we change it to im1_pts * t + img2_pts * (1-t), where t is some value between 0 and 1.

I created a total of 45 frames using linspace and compiled the images together to form a gif.

In addition to a warp fraction, we also use a dissolve fraction to determine how much of one image to fade and how much of the other. I set the warp and dissolve vals to be the same at each frame.

The "Mean face" of a population

I played around with getting the mean images of the Danes and Brazil dataset. For Danes, I only used file type 1 or "Full frontal face, neutral expression, diffuse light."


Average male face

Image warped to average male face. Original on the left.

Images warped to average shape

The following images are a little jagged even though I tried my best in picking points.

Average male warped into my face

My face warped into average male


I ended up not using the brazil set.

Caricatures: Extrapolating from the mean

For this part we extrapolate from the mean. So I took the average male face and then applied alpha values to to exagerrate certain aspects. This process is done by taking the image's pts you want to extrapolate and subtract it from some average face in this case, I used the Danes average male face I generated. Then you take the difference, multiply it by some alpha then add it back the the image's pts.

First I did some Caricatures from the average male face to mine, then my face to the average male shape.

alpha = 1.25, 1.5, -0.5

alpha = 1, 1.5, -0.25

Bells and Whistles

For my bells and whistles, I simply decided to try to morph my sister, Brittany, into the average male shape.

Shape, Just Apperance, Complete Morph

I also created a gif between characters

Lastly, I tried to morph my face into another race and gender.