by Ziran Zhou
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.
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.
iracebeth.jpg
heathjoker.jpg
DLNs_iracebeth.jpg
DLNs_heathjoker.jpg
george.jpg
heath.jpg
DLNs_george.jpg
DLNs_heath.jpg
melania.png
michelle.png
DLNs_melania.jpg
DLNs_michelle.jpg
dt_warp.jpg
bj_warp.jpg
DLNs_donald.png
DLNs_borris.png
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.
heathjoker_iracebeth_midway.jpg
george_heath_midway.jpg
melania_michelle_midway.jpg
dt_bj_midway.jpg
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.
heathjoker_iracebeth_morph.gif
george_heath_morph.gif
melania_michelle_morph.gif
dt_bj_morph.gif
Also following the requirement, I transformed my face to George Clooney's and back.
me_george_midway.jpg
me_george_morph.gif
george_me_morph.gif
combined_output_me_george.gif
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.
avg_face_all_regular.jpg
avg_face_all_expressive.jpg
avg_face_male_regular.jpg
avg_face_female_regular.jpg
avg_face_male_expressive.jpg
avg_face_female_expressive.jpg
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.
myface_warped_into_avg.jpg
avg_warped_into_myface.jpg
myface_warped_into_avgmale.jpg
avgmale_warped_into_myface.jpg
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.
caricatures.jpg
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
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.
myphoto.jpg
average-netherlands-female-face.jpg
bw-myface_avgdutchfemale_midway.jpg