CS194-26 Project 3: Face Morphing

Sairanjith Thalanki | 3032739634 | sthalanki@berkeley.edu | cs194-26-adm

Defining Correspondences

I used 13 keypoints on primarily the center of the face to determien correspondences between Picture A & B. I took the average of the two sets of keypoints and then found the Delaunay triangulation which I applied to both pictures.

George Original
George Clooney Original
Obama Original
Barack Obama Original
Obama Triangulation
Barack Obama Triangulation

Computing the "Mid-Way Face"

In the previous portion, we determined the average of each keypoint location between the two faces. We warp each face into this average face shape by computing an affine transformation for each individual triangle. An affine transformation is uniquely defined by 3 source points and 3 destination points. We use the 3 keypoints for the source and destination triangles to determine the affine transformation. https://stackoverflow.com/questions/22954239/given-three-points-compute-affine-transformation how I mathematically defined the matrices and solved the system of linear equations. Once we have the affine transformation, we iterate through the points in midway point (destination) triangle and use the inverse affine transformation to find the corresponding point in the original image. Since this corresponding point likely isn't an integer value. We can use the scipy interp2d library to find the interpolated point that we can use in the destination image. Now that I have converted face A and face B to mid-way shape and have colors for each channel, I can cross-dissolve the 2 images by taking the average for each channel.

Obama George Midway
Mid-Way face between Barack Obama and George Clooney

Morph Sequence

This portion is very similar to the previous portion. The difference is in our averaging. Previously, I took a simple average of the first and second image. Here, we will take a weighted average. The weighted average of the keypoint locations is alpha * keypointA + (1 - alpha) * keypointB. The weighted average for the cross-dissolve is similar; alpha * imA + (1-alpha) * imB. Since we are doing a morph from A to B over 45 frames, we will set alpha to 1 / frame_number.

Morph Sequence
Morph Sequence between Barack Obama and George Clooney

"Mean Face" of a Population

We compute the average face shape by reading in all of the keypoints for all of the images and then converting them to pixels and then averaging them. Next, we morph each image using the previously described strategy from imA to the mean face shape. We then take the average of all the faces (after morphing) to determine the average face shape of the population.

Mean Face
Mean Face for the Danes dataset
Danes Warp 1
Morph face into average shape 1
Danes Warp 2
Morph face into average shape 2
Danes Warp 3
Morph face into average shape 3
Ron
My (Ron) Face
Danes Ron
Morph my face into average shape
Ron Danes
Morph average face into the shape of my face

Caricatures: Extrapolating from the Mean

Now that I have morphed my face into the average face shape. I computed the difference between my morphed face and the average face. I multiply the difference by alpha (in my case 1.7) and add that to my morphed image to create a caricature.

Caricature
Caricature

Bells and Whistles: Class Video!

Ron
Ron
Danji
Danji
Class Bells Whistles
Morph from Ron to Danji for Class Video
Full Video: https://tinyurl.com/194-26-classvid

Bells and Whistles: My Favorite Sith Lords from Star Wars (excluding the best one, Jar Jar)

Kylo Ren
Kylo Ren
Count Dooku
Count Dooku
Palpatine
Palpatine
Darth Maul
Darth Maul
Darth Vader
Darth Vader
Star Wars!
Star Wars!