Project 3: Face Morphing

1. Defining Correspondences and Finding Triangulation

I defined the correspondences of two images consistently. To select paired of points from the two images, I used cpselect in python and saved the correspondences to disk. The midway shape was computed by taking the average of the correspondences. The triangulation was then found my calling Delaunay on the midway shape only once. This ensured that the same triangulation was used across the images.

The original images are shown in the following table, along with the paired points and triangulation.

Picture A Picture B Triangulation on Picture A Triangulation on Picture B Triangulation on midway shape

2. Computing the "Midway Face"

Computing the midway face consisted of three parts. First, the average shape was found by averaging the correspondences from the two images. Second, both images were warped into the average shape. Third, I cross-dissolved the two warped images into the same image by taking the average.

The most challenging part was finding the affine transformations for each pair of triangles that map from the ones in the average shape to the ones in the two images. Each affine transformation has six unknowns. For each pair of triangles, one in the target image(either Picture A or Picture B), and one in the source image(the average shape), there are three paired points, and each point contributes two linear equations involving the six unknowns. Solving this linear system of equation yields the six unknowns we want. The polygon was then used to generate all the coordinates in the source triangles in the average shape, and the corresponding affine transformations were used to find the coordinates in the target images. Each coordinate in the average shape then took the RGB values from the target images corresponding to the coordinate found by the affine transformation.

The following images show both faces warped into the average shape, and the cross-dissolved midway face.

Picture A warped into average shape Picture B warped into average shape Midway Face

3. The Morph Sequence

To generate the morph sequence, both images are warped into the shape computed by (1 - warp_frac) * im1_pts + warp_frac * im2_pts, and cross-dissolved by taking the same weights(warp_frac is equal to dissolve_frac), where warp_frac is a number increasing linearly from 0 to 1 from frame 0 to frame 45. This sequence of image was then used to produce the .gif file with 1/30 second per frame.

The following is the resulted gif

The gif generated

4. The "Mean Face" of a Population

4.1 Average Face Shape

In this part, I used the Danes dataset linked in the project page with the already-there annotations. Some preprocessing was done for the .asf files that contain the annotations to retrieve the annotated points in the images. The mean shape was calculated by taking the average of all the annotations.

The mean shape is shown as follow

The mean face shape

4.2 Morph Each Face into the Mean Face Shape

The following are a few examples of faces morphed into the mean face shape

Original Image Morphed Image GIF

4.3 Average Face of the Population

The average face was computed by first warping all the images into the average face shape, and then taking the average of all the warped faces.

The following is the average face of the population

The average face

4.4 My Face Warped into the Average Geometry

Original Image Morphed Image GIF

4.5 Average Face warped into My Geometry

Original Image Morphed Image GIF

5. Caricature

To obtain the caricature of myself with respect to the chosen dataset, I weighted the shape-only difference found in the previous part by 0.5 and added it to my own shape, and then warped my image to the added shape.

Here is the result

My face Caricature

6. Bells and Whistles

6.1 Change Gender

In this part, I used the mean faces for male and female found here, and then found the correspondences myself.

The following are the image of myself and the mean faces I found

My face Mean male face Mean female face

The following are the correspondences and triangulation for the above images. The triangulation was found by calling Delaunay on the average shape of the mean mean and the mean female.

My face Mean male face Mean female face

The appearance-only change was found by first warping both the mean male face and the mean female face into my shape, subtracting the warped mean male face from the warped mean female face, and then adding the difference to my image.

The shape-only change was found by first subtracting the mean male shape from the mean female shape, adding the difference to my shape, and then warping my face to the added shape.

The appearance-and-shape change was found by warping the appearance-only result to the added shape found in obtaining the shape-only change.

The following are the results

Appearance-only Shape-only Appearance and shape

6.2 Morphing Music Video on a Theme

For this part, I chose the images of the three well-know hypercars known as the Holy Trinity: the Ferrari LaFerrari, the McLaren P1, and the Porsche 918. They are the Italian, English and German engineering marvels. These three cars are the monsters on legal roads with the most cutting-edge technologies, that give drivers the most fantastic driving experience.

The images of the three cars are as follow, please enjoy

Ferrari LaFerrari McLaren P1 Porsche 918

Here is the link to my video

6.3 Face-morphing Music Video of the Students

In this part, I ganged up with the other 21 students in the class.

The following are my image, the next student's image, and the GIF

My Image Next Student GIF

Here is the link to the video