Programming Project #4: Face Morphing

Finding the Mid-Way Face

To begin constructing the mid-way face, I first defined 40 pairs of corresponding points between the two images. I decided to morph image of myself and Kendall Jenner, so I kept track of 40 corresponding points between these two images, such as left eye pupil, bottom of chin, and right nostril. I then averaged each pair of points, so I could construct the average shape of the two faces. After finding the average shape, I computed the Delaunay triangulation of the points for the average shape and calculated the affine transformation between each source image's triangles and the mid-way face's triangles. I used these affine transformations to determine which location to grab a pixel value from to populate the average shape I had previously computed.

My face morphed with Kendall Jenner

As you can see, the mid-way face formed from Anne and Amy is much smoother and realistic than the morph between Kendall and me. This is due to the larger contrast in lighting, position, and color between my picture and Kendall's picture. Since Anne and Amy's portraits were both taken by Martin Schoeller, the angle of the face and the lighting is much more comparable, resulting in a smoother morph.

Creating a Morph Sequence

Making the morph sequence computationaly is quite similar to creating the mid-way face above. This time, we compute the shape 45 different times for 45 frames of the morph sequence. For each frame, the warp fraction changes; that is, for the mid-way face we evenly weight the pixels and shape of the two images, but for other frames, we can change this weighting to get a gradual transition between the two images. The weight is based off of the number of frames such that the first frame has a weight of 1 for my face and 0 for Kendall's, while the last frame has a weight of 1 for Kendall's face and 0 for mine.

Because for each frame I was recalculating affines and pixel values, this part of the project took a bit longer for me to run, around ~30 minutes total to generate the gif. I wanted the gif to look seamless, so I then reversed the gif to get the transition back and forth between the two images.

The "Mean Face" of a Population

The population I chose to work with was the Danes database. I first averaged all the annotated points to get the average shape of the population. Then, I morphed each image into the average shape before stacking them. In the end, I ended up generating the average shape of all the men in the database. To get a smoother transition between the face (where the annotations were) and the rest of the picture, I added points for the four corners as well. Although this increased the runtime of my code since more points had to be warped, it resulted in a smooth blend between the cross-dissolved and warped section of the "mean face."

"Mean Face" of Population
Original #5 v. Mean Shape #5
Original #26 v. Mean Shape #26

Here we can see two examples of faces in the dataset morphed into the average face. Man #5 looks still fairly normal even when warped into the mean shape, but you can see that man #26 looks quite odd. This is most likely due to how different their face shapes are from the mean face of the population. Since #26 has quite distinguishing features already, his face shape warp is more extreme and noticeable.

Morphing My Face to Mean
Morphing Mean Face to Mine
Caricature of My Face

Although the images may be pretty unsettling, the strange morphed images are a consequence of how different the facial structure is between my face and the Dane mean face. My less pronounced bone structure, much smaller forehead, and difference in facial expression resulted in the uncanny-looking morph when morphing between the two.

For the caricature image, I used an alpha value of 1.25. There are some jagged edges in the picture due to the large contrast in the placement of the corresponding points between the two faces.

Bells and Whistles

For the Bells and Whistles part of the project, I decided to make a video morphing between the faces of the people in my fraternity's pledge class. I used pictures against a white background and from similar lighting and angles to make the transition smoother. Though the transition was still not as smooth as I'd like it to be due to the poor quality of the images, I think overall, the morph video is still quite entertaining. I overlayed the song Sk8r Boy by Avril Lavigne because the song is a funny inside joke within our class.