In this project I explored the idea of morphing faces into others, done through warping the image shape and cross-dissolving the image colors.
I used the following two images for the first half of the project, morphing my face into that of Daniel Craig.
I selected keypoints based on the features on the faces (eyes, ears, nose, head shape), then added points for each corner of the image, and used Delaunay's algorithm on the average keypoints to compute the triangulation.
Using an affine inverse warp, I created a midway face, which involves computing the average shape of the two faces, warping the two images into that shape, and averaging the colors together.
jerry.jpg | midway face | danielcraig.jpg |
---|---|---|
Creating the 45 frame morph sequence from the start image to the end image uses similar techniques to the ones used for the midway face. But rather than using the mean, I calculated a weighted average for increments from 0 to 1.
For this part of the project, I calculated the mean face of the Danes dataset, given the images and keypoints in the data. This involved first reading the data to extract the keypoints, then averaging them all and calculating a Delaunay triangulation based on the average. Then I morphed each face into the mean shape, and calculated an average color value.
Some of the images are shown below.
01-1m.jpg | warped into mean shape |
---|---|
09-1m.jpg | warped into mean shape |
---|---|
17-1m.jpg | warped into mean shape |
---|---|
24-1m.jpg | warped into mean shape |
---|---|
30-1f.jpg | warped into mean shape |
---|---|
40-1m.jpg | warped into mean shape |
---|---|
The average face is:
To warp my shape into the average face, and vice versa, I first selected points on my face in the same order that the points in the dataset were selected. Then I warped the images into the desired shape.
Points on average face:
Points on my face: (in the same order)
My face | warped into mean shape |
---|---|
Mean face | warped into my face shape |
---|---|
To create a caricature, I extrapolated the differences from the mean, with the formula new_shape = average_shape + alpha * (my_shape - average_shape)
alpha = 0.5 | alpha = 1.0 (original image) | alpha = 1.5 | alpha = 2.0 |
---|---|---|---|
Changing my face's gender, using the average female face from the Danes dataset.
Average female face in Danes | Changing shape | Changing appearance | Changing both |
---|---|---|---|