Project 3 - Face Morphing

Part 1

I began by cropping and rescaling the images of myself and LeBron so that they would have identical dimensions. I then proceeded to use an online tool to choose a collection of points (31) that matched so that I could produce the warping shapes. This included the four corners of each image. I then took the mean of corresponding points and computed Delaunay triangulation using SciPy.

Cathedral
Me
Triangulated image of me.
Church
Goat
Triangulated image of LeBron James.

Part 2

The next step for me was to compute the midway image between myself and LeBron. To do this, I began by computing the average shape using the triangulation points corresponding to each other from each image and averaging them. After taking the Delaunay triangulation of this, I calculated the inverse of the affine transformation matrix between the original triangle in each image and the corresponding triangle in this average shape. I used polygon to then obtain all the pixels in each triangle and do interpolation using RegularGridInterpolator (Scipy). I also cross-dissolved the warped images, taking half of each and adding (for each pixel) to obtain this midway image.

Cathedral
Me
Plain image of me
Church
Goat
Plain image of LeBron
Emir
Midway
Warped and cross-dissolved image of myself and LeBron, with warping and dissolving constants of .5 each.

Part 3

I applied what I did in part 2, now instead of using strictly .5 as the warping/dissolving constant I used a range of values between 0 and 1. I used exactly 45 values, inclusive of 0 and 1 (np.linspace helped here). I then created a GIF file which shows the morphing from myself to LeBron.

Cathedral
GIF
45 distinct values of t including 0 and 1 in that range.

Part 4

For this part, I used the FEI face database. In particular, I used the A images (100). I parsed through each of the text files for points to obtain corresponding keypoints for each image and averaged to get the average shape. I then morphed a few of the images into this shape (selection shown below). I also morphed all the images into this shape and took the average to obtain the average face. Finally, I morphed my own face into this average shape, and taking the geometry of my own face, morphed the average face from the dataset into mine.

Cathedral
Person 1A
Cathedral
Person 1A (morphed)
Cathedral
Person 2A
Church
Person 2A (morphed)
Emir
Person 3A
Harvesters
Person 3A (morphed)
Emir
Person 4A
Harvesters
Person 4A (morphed)
Emir
Average of all
Harvesters
Average onto my geometry
Harvesters
Me
Harvesters
Me onto average geometry

Part 5

Here I used alpha values of -1 and 2 to exaggerate both my features and the population's features, using my face (where 0 is my shape and 1 is the population average shape).

Cathedral
Alpha = -1
Exaggerating my own features.
Cathedral
Alpha = 2
Exaggerating population features.

Bells and Whistles 1

Here I morphed myself onto the average Chinese male face taken from here. I created images for just dissolving, warping, and both (all t = .5).

Cathedral
Average Chinese Male Face
Cathedral
Warping
Cathedral
Dissolving
Cathedral
Dissolving and Warping

Bells and Whistles 2

Here I once again morphed myself onto the Chinese male face. However, this time I used cv2 to implement gradient blending. I used Sobel to differentiate the images and blended together the gradients, creating a total of 30 frames for a GIF below.

Cathedral
Me onto Chinese Man - Gradient

Bells and Whistles 3

Here I morphed together a few different popular NBA players, mostly from the Los Angeles Lakers. I added 'All of the Lights' by Kanye West and others to form a music video, inspired from the video game 'NBA 2K14'. Enjoy! Link

Bells and Whistles 4

This time I chose to try pixelation instead for morphing two images (Bronny and LeBron). Results are below.

Cathedral
Bronny/LeBron