CS 194-26: Image Manipulation and Computational Photography, Fall 2017

Project 4: Face Morphing

Justin Mi, CS194-26-afy



Overview

This project introduces us to face morphing, where we seemlessly transition one face to another between two different face images. When we create these transitions, we must keep in consideration color and shape of the faces




Computing the Midway Face

Given two face images A and B, we want to compute the average face between the two. To do this, we first pick points on A and B that define major facial features: eyes, nose, mouth, etc. These points should be consistent pairwise across the two images. For example, if there is a point on A's nose, there should also be a point on B's nose. The two images I will use using are of me and my friend Jacky who is also in the class. I do want to note that Jacky also used the same two images and got very similar results for this section, as to be expected; however, we did not share code or points data.

Then, we find the mean of the two sets of points relative to each pair of corresponding points and then generate a Delaunay triangulation on the average points. Using this triangulation, we can calculate the affine transformation of each triangle in A and B (as defined by the Delaunay triangulation) to the corresponding triangle in the average triangulation. Using this mapping as a general guide, we can compute the inverse transformation on each pixel in the average image to retrieve the corresponding pixel in A and the corresponding pixel in B that maps to given pixel in the average image. Using the two pixel values, we can then cross-dissolve the pixel values with a factor of 0.5 to uncover the value of the pixel in the average image. Below is the result.

Me
Jacky
Jackstin?



Image Morphing

As an extension of the previous section, we can then take the two images A and B and generate a set of intermediate images that show the gradual transition in the morph between A and B. To do this, we generate the mean triangulation as before and use those to find the corresponding pixels in A and B. However, when generating the cross-dissolved pixels, we use a sliding-scale factor instead of 0.5, as when calculating the exact mean image from part 1. The overall formula becomes A_pixel * warp_factor + B_pixel * (1 - warp_factor). By gradually decreasing the warp factor, we can iteratively generate intermediate images that at first look very similar to the source image A, but gradually begin to look very similar to the target image B.

Transition From Me to Jacky



Mean Faces

In this part of the project, I calculated the mean face of a large number of male Danish scientists (approximately 40). First, I calculated the triangulation of the average keypoints of all the images. I used this triangulation, and calculated the transformations needed to transform each triangle to each corresponding triangle in all the images. Using those transformations, I performed an inverse transformation on each pixel in the mean image to retrieve the corresponding pixels in each of the image set. Then, I cross-dissolved all the pixels together, and got the mean face of the male Danish scientists.

Average Male Danish Scientist

Here are a couple Danish scientist faces warped to the average.

Regular
Warped
Regular
Warped
Regular
Warped

Here is an image of me warped to the average. And an image of the average warped onto me.

Me, Warped
Warped



Caricatures

To accentuate various facial features of mine, I extrapolated from the Danish population mean of male scientists. I took the difference of the keypoints for my face and the average, then added the difference to my points and generated a triangulation. From there, I proceeded with the regular warping method.

Me
Me, Caricatured with Alpha 25%



Class Video

I participated in a class video with about 20 other people. I appear at around the 30s mark.