CS 194-26 Project 4

Face Morphing

Regina Xu (aat)


Mid-way Face

The goal is to warp together images using techniques like triangulation and affine transformations. The algorithm for a warp between im1 and im2 is as follows: first select corresponding points (e.g. nose on im1 to nose on im2) between the images using ginput. Then compute the mid-way face by taking warp_frac*im1 + (1-warp_Frac)*im2, and get a Delaunay triangulation on this mid-way image. For each triangle from the Delaunay triangulation, find the affine projection matrix M that transforms source image S to destination image D where M*S = D so M = D*S-1. Now perform the inverse warp by applying M-1 to the pixels in each triangle to get the source coordinates, and then interpolating those coordinates to blend the color values. The mid-way face comes from the average of the warped images for im1 and im2.

Morph Sequence

The algorithm above gives the morph at one frame, so to create a morph sequence, apply the algorithm 46 times while varying the warp_frac and dissolve_frac from [0, 1]. The resulting images are stitched with ezgif.com to create an animated gif shown above.

Mean Face

To find the mean face of a population, I take the Danes dataset which comes with the correspondence points. I select all *-2f and *-2m images of people smiling with teeth and their .asf files, then select the correspondence points for my own face image. Then I apply the same algorithm to warp each face to the average face geometry and then get the average appearance by averaging the pixel values.

Inputs:

Sample outputs from morphing inputs into average shape

Mean face followed by my face morphed to average geometry and mean face morphed to my geometry

Caricatures

Caricatures are deviations from the mean and are computed using warp_frac > 1 to exaggerate features like the squared jaw and curved eyebrows.

warp_frac = 1

warp_frac = 1.2

warp_frac = 1.5

Bells & Whistles: Changing gender and smile

In this part, I morphed my shape, appearance, and then both to that of the average Chinese man (source). The morph also shows change in smile from without teeth (average Chinese man) to with teeth (me).

Me

Average Chinese man

Morph sequence

Shape only: warp_frac = 1.0, dissolve_frac = 0.0

Appearance only: warp_frac = 0.0, dissolve_frac = 0.5

Both: warp_frac = 0.5, dissolve_frac = 0.5