Overview

In this project, I followed the instructions and the background introduction of the spec and explored how to use of triangulation and various other methods to warp faces of people and blend together and caculate the average.

Part 1: Defining Correspondences

I start with the manual selection of corresponding (key)points on two images, and consistently labeling in the same order of these points across the images and once defined they are saved to avoid redundant work for future sessions and I also calculated the triangulation of these points to create a mesh for morphing, using Delaunay triangulation for preferred geometric efficiency, typically computed on an average shape from the input sets to minimize distortion duirng morphing. The pints are stored in JSON file for persistence and read back when needed.

Part 2: Computing the "Mid-way Face"

In this part I wrote out the computeAffine function which uses affine transformation for each triangular section by the DLN triangulation. Then I calculated the average shape of the 2 faces from finding th emidpoint for each corresponding pair of keypoints from the 2 images, giving a new keypoints set representing an average-d face shape. Then I warp both faces to the average shape and after I have the two warped faces I then have their color values averaged at pixel level to ensure the resulting midway face matches also in texture and color, essentially creating a blend. I looped over each triangle to avoid looping over individual pixels and warping at a higher level by transforming whole triangular regions at once using precomputed affine matrices.

Image 2.1

heathjoker_iracebeth_midway.jpg

Image 2.2

george_heath_midway.jpg

Image 2.3

melania_michelle_midway.jpg

Image 2.4

dt_bj_midway.jpg

Part 3: Hybrid Images

In this part, I morphed two images into one another using a sequence of transformations based on specified control points and traingulation. I computed a morphed image by blending two source images which are warped to a degree, and this is achieved through first warping to an intermediate shape determined by a linear combination of initial and target control points and then combied to a level by warp_frac parameter and then teh warped images are blended using a cross-dissolve technique regulated by the dissolve_frac parameter. I then combined all the morphed images to create a smooth transition from 1st to last in a output gif file to animate the change.

Also following the requirement, I transformed my face to George Clooney's and back.

Image 3.5

me_george_midway.jpg

Image 3.8

combined_output_me_george.gif

Part 4: The "Mean face" of a population

In this part I analyzed the facial keypoints across a teh FEI dataset of annotated faces, in order to compute and visualize the average facial structures and features, and to enable comparisons across various demographic groups (I chose the Male/Female subgroups for analysis). This involved choosing a suitable dataset and calculating the mean face shape for teh entire dataset or specific subgroups of it.

I first loaded and preprocessed teh images and get their coresponding keypoints in order, and then I calculated the average face shape by averaging teh shape/keypoints distribution, then I warped each individual face in the dataset to this average shape. I then layer them together and average the color in the eventual face to get the average face.

I then further transformed my own face to fit the average geometry and adapted the average face if the population and of male subgroup respectively to match my facial structures.

Part 5: Caricatures: Extrapolating from the mean

I extrapolated from a calculated popylation mean from the previous part and used it to create exaggerated caricatures of my facial features, by modifying the degree of exaggeration through the use of scaling factors (alphas) that extend beyond the typical range of [0,1] and by choosing extreme alphas out-of-range, I was able to create some unusual and pronounced features or distortions on my face.

Image 5.1

caricatures.jpg

Part 6: Bells & Whistles

Music Video - Princes

This part is the creation of the music video on the theme of Royalty (Princes), including Prince Harry of the UK, Prince Mohammed bin Salman of Saudi Arabia, Prince (Prince Rogers Nelson), Prince Jigme Namgyel Wangchuck of Bhutan, Prince Moulay Hassan of Morocco, and Prince Fumihito of Japan.

The music is Purple Rain by Prince

princes-mv.mp4

Changing Gender/Race

This part is the changing of gender/race from my face to another average. I chose the Average Female Face from the Netherlands due to their distinct blue eyes and pronounced facial bone structure, and after the blending, I certainly see how their features were blended onto my face.

Image 6.3

bw-myface_avgdutchfemale_midway.jpg