Project 4: Face Morphing

In this project, I wrote code to handle the processing of various images of faces, alongside annotations of feature points in these faces. After constructing a triangulation using these feature points, I implemented a moprhing algorithm that attempts to reverse sample into the morphed region from the triangles in their respective original images. This sampling required the implementation of an affine transformation matrix. I found a straightforward solution that involves finding suitable transformation matrices to the standard basis, inverting one of the matrices, and composing them. The rest involved straightforward image processing techniques (interpolating values, etc.), most of which were easy enough to implement with Matlab's existing matrix arithmetic functionality.

Morphing GIF

Say hello to Cloon-Z.

Average faces

In this section, I utilized my existing code to average out face geometries and construct new images using this averaged data. The existing morph code did the brunt of the heavy lifting here, and most of the code in this section simply served to batch process the images of the Danes.

Averaged face

Geometry-averaged Danes

Male faces (since the dataset is male dominant), especially those that appear quite similar to the average save for a scaling transform, are not morphed as dramatically.
Female faces tended to become longer and somewhat more masculine, due to the imbalance in the dataset. Note that regions above the eyebrows show surprising deformations; this is because the labeled points in the dataset do not trace along the forehead.
Faces that were somewhat more expressive tended to become morphed towards the more neutral expression which appears in the average image.

Me and the Danes

The morph function definition provides enough countrol to generate a morphing of the average face to my face geometry, and vice versa fairly painlessly. Additionally, the caricature was simply a matter of extrapolating further in the direction of the geometry/values of my face.

Average Dane to Me

Most noticeably, my lips are far more thick and narrow than the average Dane's, and that feature appears deeply exaggerated in the morphed average.

Me to Average Dane

My face appears deeply distorted, especially due to the presence of the glasses. In terms of features, my face is made narrower, eyes larger, and my lips are extended.

Caricature

Technically, this is an exaggeration of the differences between my face and that of an average Dane in a particular CS department. This emphasizes the most noticeable differences, namely the lips and narrower eyes.

Gender morphing

To implement the gender morphing, some modifications were required to allow for the morphing towards an arbitrary geometry-- i.e. a face shape defined by points which are not necessarily an interpolation between two sets of existing points. The same was necessary for face image values.

Original image.
The overlay visibly brightens certain parts of the face, emphasizing and making warmer the brow ridge, while also lightening features overall.
The geometry shifts tend towards a larger forhead and rounder chin, along with larger eyes. The strange dip midway through the face could be explained by a more dramatic shift between the two gender images where the ear meets the head, or it could be noise from slightly misplaced labelings.
There appears to be some misalignment due to differences in background and the fact that there are no points defining geometry past the face.