Goal: Morph faces into one another through warping image shape and cross-disolving image colors
First I defined correspondences on both images (my face, and my friend's face that I wanted to morph into). This was done using matplotlib.pyplot ginput tool. A Delaunay triangulation for the average image was computed from these points.
Selecting points on my face
Delaunay triangulation of mid-way face
To compute the morph sequence, I took this steps:
1. T-way shape: With the correspondences of both images, I used the equation t*(initial_img_point) + (1-t)*(final_img_point) where t = (0, 1) to find the triangulation of t-way face. For the mid-way face, t is just 0.5. Using these triangulations, I create the t-way shape that I want to warp my initial and final images into.
2. Affine Matrix: For each triangle in the t-way shape, I compute the affine matrix, M, that allows for transformation from t-way triangle to source triangle. The affine matrix is computed by giving 3 pairs of correspondences between t-way triangle and source triangle.
3. Warp: I do M*pixel for all pixels in the t-way triangle. This gives the pixels new locations in the image a.k.a. warping.
4. Cross dissolve: In addition to warping the shapes, the colors are cross dissolved using the same equation t*(initial_img_pixel) + (1-t)*(final_img_pixel) where t = (0, 1).
Initial face (my face)
Final face
Midway face
Morp sequence
Initial face
Final face
Midway face
Morph sequence
I comupted the average face over 15 Danish men (who were all smiling). The images were taken from this database. This was done by computing the average face shape, and warping each image to the average shape. Colors were cross-dissolved too. Here are some images of danes before and after warping to the average face shape.
Original face
Warped to average shape
Original face
Warped to average shape
And here is the result of the mean face.
Average happy Dane
Average shape
My face warped to average dane shape
Average dane warped to my face shape
As you can tell, the forehead shape of the warped images are not very well defined. This is because the dataset did not select correspondence points that focused on the forehead shape, but focused on features.
Correspondence points of Dane set (taken from Piazza)
Since my face was rather different from the happy Dane men dataset, I went to this site, which has averages of faces of people in the Americas. I chose an average Peruvian women face.
My face
Average Peruvian woman's face
To produce the caricatures below, I warped my face shape to the following shape: my_faced-shape + lambda*d-shape, where d-shape = my_face_shape - avg_peru_shape. I experimented with various values of lambda.
lambda = -0.5 (more like my face)
lambda = 1 (more like peruvian face)
lambda = 1.5 (more like peruvian face)
My face morphed to our average shape (slimmed face, higher forehead)
Midway face
Peruvian women face morphed to our average shape (broader face)