Proj 4: Face Morphing

CS194-26

Zac Dehkordi (adl)

The purpose of this project was to come up with an algorithm capable of warping one image into another image, specifically facial warping. To do this we have to take into account both shape and color. For shape, we solved this problem by computing a triangulation across both images and finding the affine transformation between all the triangles in the image. For a smooth warp, we simply slowly transform the triangle of one image into the triangles of the other image. For color, we did a simple cross-dissolve by essentially averaging the colors of the pixels between the images.

To compute the midway-face we first had to define correspondences for both images and then compute an average correspondence. We used the average correspondence for the triangulation for all of the images. From there we warped the shape of each image into the midway image (using an affine transformation) and then cross-dissolved the colors between the two images using inverse warping to find the corresponding points across triangles.

For the morph sequence I computed 44 transition frames (46 frames total) between the images by recursively adding 1/46 to the warp_frac / dissolve_frac each time.

Using an online dataset, I then computed the “mean face” of a population of smiling males. I computed the average shape by averaging the mean of all the given correspondence points from the data set.

This is the correspondences of the avg. face of the entire population. (note that the graph is upside-down because of the pyplots scatter() function. The coordinates were fine in practice). Using this correspondence set, I morphed all the faces in the population into the mean-shape. A few have been provided below.

Originals

Morphed

Next, I morphed and cross dissolved each image into the avg. shape. Below is the output, known as the “mean face” of the population.

Below are some other examples of the mean face being morphed into my face shape, and my face being morphed into the face shape of the mean face.

Next I produced a caricature of myself by extrapolating my face from the population mean. I did this by morphing my face into the caricuture face. This I calculated as caricuture_correspondences = (avg. correspondences) + alpha * (my_correspondence - avg. correspondence)

alpha = 1 | alpha = 1.5 |

alpha = 1.5 | alpha = 2 |

Using a already averaged image of the Han Chinese in mainland china. I morphed my face into theirs, in effect changing my ethnicity.

original image | avg. chinese | only shape change | only appearance change |

Final Result!

asian Zac