cs194-26-aga
For this project, our task is to morph one face into another face, using both the shape of the face as well as the actual color values of the image. In order to morph one face's shape into another, we need to define pairs of corresponding points. The points need to be consistent across both faces, i.e. a point corresponding to Mark's right pupil must also correspond to Jeff's right pupil. Once we define the correspondences, we can create a mesh for the faces by computing a Delaunay triangulation. Below we show the points which we used for the correspondences:
Then, using these points, we can compute a triangulation for each face. In the next sections, we will actually find the midway face by computing the average triangulation for a set of faces, but below we show the triangulations for Mark and Jeff. The Delaunay triangulation is the best as it avoids narrow triangles, which will give us a nice set of polygons to use for our morphing.
Next, we compute the midway face by finding the average of the correspondence points between our two faces, Mark and Jeff. Then we create a triangulation based on those average points, as described above. In order to warp the keypoints from Mark and Jeff's faces into the midway face shape, we have to compute an affine transformation matrix which will allow us to warp between two triangles. We can compute this transformation by simply observing that since the affine matrix will be multiplied by the source triangle in order to get the target triangle, we can use the equation:
dot(pts1, inverse(pts2))
.
Then, once we have our affine transformation matrix, we can warp the shape of each face into the midway shape. We cam also cross-dissolve within each of those triangles to get the midway color of each face as well. Below we show the midway face between Mark and Jeff:
Once we have a morphed image, we can easily adjust parameters to allow for different amounts of warping and cross-dissolving. We set a couple of parameters, warp_frac
and dissolve_frac
to varying values ranging from 0 to 1 in order to create a smooth gif of two faces morphing into each other.
Next, we compute the mean face of a population using a dataset of Danish faces. In order to do this, we first compute the average face shape of the whole entire population, using the annotated keypoints. Then, we warp each of the faces in the dataset into the average shape. Some examples of warped faces can be seen below:
Once we have morphed each of the faces, we can cross-dissolve the colors of each of them in order to get the mean face:
In addition, I can warp my face onto the average geometry, and warp the average face onto my geometry.
Next, we explore some caricatures by extrapolating from the mean population.
For this part, I change my face into the average female face based on the Danish dataset. The average female face, and my face morphed onto that geometry, is below: