The goal of this project is to implement face morphing. We achieve this by choosing points on an image that define its features, create a triangulation with those points, then apply affine transformations to the triangles and interpolate the colors.
I used an image of President Obama that I found, as well as the image of George Clooney linked on the project page.
|
|
Next, I used ginput
to select feature points on each image, before using those points to generate a Delaunay triangulation.
|
|
I took the average of the keypoints found in the previous section to get the keypoints for the average shape, and used those to create a mid-way triangulation. I generated affine matrices for transforming mid-way to Obama and mid-way to Clooney, then warped the faces into the mid-way shape. I used RectBivariateSpline
to interpolate the color from the source triangles.
|
To create the morph sequence I repeated the same process I did for the midway face, except I weighed the two images differently for each frame. I kept the warp fraction and the cross-dissolve fraction the same weight per frame, so an image with dimensional weight 0.1 would also have a color weight of 0.1 when generating the frame. The gif starts with Clooney and morphs into Obama.
|
I used the provided Dane dataset and used only the neutral faces to create a mean face shape, then warped and averaged the colors of the individual faces to that geometry.
|
|
|
|
I then attempted to warp my own face to the Dane average geometry and the Dane average to my geometry, to limited success. These are the results after adding extra points around the upper head:
|
|
Making a caricature of myself using the average Dane features created a spiky monstrosity, so I went and found an "Average Chinese Male" face to use instead. The results...aren't much better. More points, as well as more consistently placed points, would likely help, as in some cases a point on one image would be at the edge of the iris but the corresponding point would be slightly off and closer to the corner of the eye instead.
|
|
I found an "Average Chinese Female" face in the same location as the "Average Chinese Male" face, so I transformed my face into a more feminine-looking one. This transformation worked out far better than the caricatures did. Transforming my face fully into the average female geometry turned out far too angular, so when warping both color and shape I merged them with a weight of 0.5.
|
|
|