Face morphing!

Roma Desai | CS-194 Project 3

 

DEFINING CORRESPONDENCES

 

To begin morphing faces, we must first identify features or points where the two images match. For this part, I wrote a function to take user input and store the locations of the corresponding points. For a face, about 25 points gave a pretty good result. Once I had the corresponding points, I computed the average of the two sets of points and computed a Delaunay triangulation. Computing the triangulation on the mid-way shape gives a much smoother result. A Delaunay triangulation is especially useful because it gives us “nice” triangles which are not overly skinny. If triangles are too skinny, they may span a longer portion of the image which could lead to subpar results. Here is the triangulation displayed on my two input images:

 

 

My friend Pallavi

Me!

Chart

Description automatically generated

A picture containing diagram

Description automatically generated

 

 

COMPUTING THE “MID-WAY FACE”

 

To begin morphing, I first formed the average shape of my two image points. Then, I inverse warped the average shape into the two before and after images. Finally, I averaged the two warped images together to get the final result. To do the actual inverse warping, I used an affine transformation to map each average shape triangle to one of the image triangles. I used interpolation to ensure the transformation would land on actual points in the images. The results are shown below:

 

Pallavi

Me

Palla-me

A person smiling for the camera

Description automatically generated

A person smiling for the camera

Description automatically generated

A person smiling for the camera

Description automatically generated

 

 

 

THE MORPH SEQUENCE

 

This section was putting together all the hard work from the section before! Instead of computing only the mid-way face, I computed 45 in-between frames that showed the transition from one image to the other. Putting this together in a GIF, we get the following results:

 

Palla-me

Ari + Broccoli

My brother + My dog

 

 

 

THE “MEAN FACE” OF A POPULATION

 

For this section, I used a database of Brazilian faces to find the “typical” Brazilian face shape. I decided to only use 50 images out of the set of 200 due to the time my laptop takes to run. The images were pre-annotated with corresponding points so all I had to do was read in the points. Once I had all the points, I found the average shape, warped each image to the average shape, and then averaged all the images together.

 

Here are some examples of faces warped into the average shape and the resulting mean face:

 

Face 0

Face 1

Face 2

A person looking at the camera

Description automatically generated

A person looking at the camera

Description automatically generated

A person posing for the camera

Description automatically generated

 

Mean Face

A person posing for the camera

Description automatically generated

 

I also tried to warp my own face to the mean face and vice-versa. The results are shown below. When morphing the mean to my face, you can see that the mean face got smaller since my face is also much smaller and narrower. When morphing my face to the mean face, you can see that my face became much larger and more rectangular to better match the mean face.

 

My Face

Mean Face

A person smiling for the camera

Description automatically generated

A person posing for the camera

Description automatically generated

Mean face in My shape

My Face in Mean shape

A close up of a person

Description automatically generated

A person smiling for the camera

Description automatically generated

 

 

CARICATURES: EXTRAPOLATING FROM THE MEAN

 

For this part, I extrapolated my own face from the mean by adding more of the features that cause my face to differ from the mean. In general, caricatures are known for emphasizing unique features of faces. My result is shown below. One of my key features compared to the average face is that my face is narrower especially at the lower half of my face. Since I am moving my face further away from the mean, the resulting image caused my face to become even narrower.

 

Before

Alpha = .5

A person smiling for the camera

Description automatically generated

A person smiling for the camera

Description automatically generated

 

 

BELLS AND WHISTLES

 

1. Roommates Morphing Video ft. our current favorite song @G-Eazy

 

Here, I made a video that morphed together all of my housemates. I thought playing our current favorite song in the video was fitting.

 

Check it out below!

https://youtu.be/OymVUGsOKQg

 

 

2. Changing Ethnicity

 

For this part, I tried to make myself into a Russian woman! As you can see, my face was made wider at the bottom and a little longer to match the shape of the average Russian face.

 

Me

Russian Woman

Russian Roma

A close up of a person who is smiling and looking at the camera

Description automatically generated

A close up of a person

Description automatically generated

A person smiling for the camera

Description automatically generated

 

 

3. Class Morphing!

 

Some of us in CS 194 got together and created a class morph video. Together, we created an order, morphed each of our faces to the person’s after us and finally put all the individual videos together accompanied with some cool tunes. Check it out below!

https://youtu.be/O3vouduLS3w