CS 180 Project 3

Name: Brandon Wong

Overview

The goal of Project 3 is to morph pairs of images of faces from one to another and anywhere in between, changing both shape and colors in differing amounts. By taking matching points in different images and enabling the triangles obtained from those points to morph into each other, faces can be manipulated and morphed in interesting ways to obtain a variety of results. The first three parts are developing the morph and morphing my face with a friends. The rest of the parts are doing interesting things with the results from previous parts.

Part 1: Defining Correspondences

In this first part, the corresponding points between my face and my friend's face were placed in the pair of images. This was done using the labeling tool given in the project spec linked here. After obtaining the points, the Delaunay triangulation was calculated on the points from my face and applied to the points from both images.

my_face_small

My face

friends_face_small

Friend's face

me_triangles

My face with triangulated points

friend_triangles

Friend's face with triangulated points

Part 2: Computing the "Mid-way" Face

In this part, the mid-way image of a morph between the two was calculated from the triangulation made in the previous part. The first step was to calculate the average shape of both images by finding the averages of the corresponding points obtained on them. The second step was warping both faces to that shape by finding an affine trainsformation matrix converting each triangle into the next and using an inverse warp to avoid holes, applying this to every pixel within the triangle. The final step is averaging the colors of the corresponding triangular section interpolated via nearest neighbors to get the resulting colors for the average from the original images.

me_triangles

My Face

average_face

Mid-way Face

friends_face_small

Friend's Face

Part 3: The Morph Sequence

In this part, I finally put together the code for performing the morph based on the code for the average (the same thing except with warp fractions and dissolve fractions different from 0.5) and used it to find the images for 43 evenly separated points in the morph between my face and my friend's face. These points plus the original images to make 45 points were then put together into a 1.5 second gif displaying the morph sequence formed from 45 frames at 30 frames per second.

me_to_friend

Gif of my friend's face becoming my face

(The gif may not loop, if so, please reload the page to see morph again)

Part 4: The "Mean Face" of a Population

In this part, I used the spatially normalized frontal images with corresponding points already manually annotated for each image from the FEI Face Database linked here. The images I used were 200 images of people facing the camera with neutral facial expressions, 100 male and 100 female images. The images were already annotated with 46 corresponding points in each image. The mean face was found from these images, and then I warped the shape of ten of the images to that average and shown below after their originals.

average_of_faces

Average of FEI Face Database Faces

original_0

Original 1

example_0

Example 1

original_1

Original 2

example_1

Example 2

original_2

Original 3

example_2

Example 3

original_3

Original 4

example_3

Example 4

original_4

Original 5

example_4

Example 5

original_5

Original 6

example_5

Example 6

original_6

Original 7

example_6

Example 7

original_7

Original 8

example_7

Example 8

original_8

Original 9

example_8

Example 9

original_9

Original 10

example_9

Example 10

I also found the resulting image from my face converted into the geometry of the mean face and vice versa.

me_to_avg

My Face to Mean Face

avg_to_me

Mean Face to My Face

Part 5: Caricatures: Extrapolating From the Mean

In this part, I obtained a neutral expression caricature of my face using the average of neutral faces from the previous part and the equation result = im1_points + alpha * (im2_points - im1_points) to obtain the corresponding points for warping. I then put these new corresponding points through the rest of the standard morph function to obtain an exaggerate neutral expression face of my face based on the average neutral expression face, exaggerating the shape of the neutral expression face while having the colors of my own. This ended up as an exaggerated version of the my face to mean face of the previous part.

frown_caricature

Neutral Caricature of My Face

Final Part: Changing Gender Bell and Whistle

In this part, I used a mean east/southeast asian woman image found on google to try and switch the visible gender of my image (chosen since I'm east asian myself). I found a variety of different morphs between them: one of just the shape, one of just the appearance, and one of both but not to the full extent. The morph of both (essentially the midpoint between the two images) appeard to have the best result. The results are shown below.

me_resize

Me

me_to_woman_shape

Morph Shape

me_to_woman_appearance

Morph Appearance

me_to_woman_both

Morph Both

woman_resize

Mean East Asian Woman