# CS 194-26 Proj3: Face Warping

## Defining Correspondances

This part was fairly simple. To standardize the points, I used IMM’s face annotation, which by the end of this project I had memorized :^(

As stated in the directions, to properly merge two images I triangulated on the average points, not wither image on its own. On top of that, to make the background properly merge I added each of the corners. Looking back, my morphing might have been smoother if I also included:

- The shape top of the face,
- The top of the head
- the shoulders

However, at the end it still looked pretty good. For me and Danny, the average face’s triangulation is this:

## Defining the midway face

To find the midway face between two faces, first I got the average triangulation. Then for each triangle, I defined the start matrix S as

S=⎡⎢⎣y0y1y2x0x1x2111⎤⎥⎦$$S=\left[\begin{array}{ccc}{y}_{0}& {y}_{1}& {y}_{2}\\ {x}_{0}& {x}_{1}& {x}_{2}\\ 1& 1& 1\end{array}\right]$$

where the points of the starting triangle are [yi,xi]$$[{y}_{i},{x}_{i}]$$

and the end matrix E as

E=⎡⎢⎣a0a1a2b0b1b2111⎤⎥⎦$$E=\left[\begin{array}{ccc}{a}_{0}& {a}_{1}& {a}_{2}\\ {b}_{0}& {b}_{1}& {b}_{2}\\ 1& 1& 1\end{array}\right]$$

where the corresponding points of the ending triangle are [ai,bi]$$[{a}_{i},{b}_{i}]$$

Then I define a transformation matrix from S to E as

ST=E⟹T=ES−1$$ST=E\phantom{\rule{thickmathspace}{0ex}}\u27f9\phantom{\rule{thickmathspace}{0ex}}T=E{S}^{-1}$$

This worked pretty well. Now, some issues were happening with singular matrices (happening from a triangle which is actually colinear), however this was solved by returning a zero matrix if S is not invertible.

This turned out pretty well! The transformations for my 400x400 images took around .5s, which isn’t too fast but also not too slow. Here’s the results of the midway between my face and Danny’s:

There’s some tiny discrepancies in the transformation because the angles are different, but if I were to look at that image I’d think that’s Arjun DeVito so I’ll call that a win.

Here’s some more images I got from playing around with different merges/dissolves:

### Perfected

These images were obtained by molding faces to the “perfect” face

Alarmingly happy Danny:

The perfect Arjun:

### Messed up

These images I got while trying to get the transformations right

Drunk Danny:

Drunk chiseled Danny:

Even drunker Danny:

### IMM faces

These faces I got while morphing faces to the IMM annotation dummy image

IMM Annotated danny:

### Thanos

These faces I got from morphing images to Thanos (some with morph factors of over 1 or under 0, creating almost-caricatures)

Thanos Arjun

Arjun Thanos:

Small chin Christian:

Big chin Christian:

Neandrathal Kyle:

Big Chin Mike:

Bigger chin Mike

Biggest chin Mike

Baby Mike:

C h i s e l e d Danny:

## Morph Sequence

Here’s a morph from me to my housemate:

What’s kind of weird about this is that the intermediate faces kind of look like one of our mutual friends…

## Mean population

### FEI Database

The population I chose was the FEI Face database. To find the mean of this db, I first converted the .pts files given to a python array of points, I added the corners of the image, and then I averaged each of the points together to get the average shape. Finally, I morphed each image to that average shape and averaged the images together. Here’s the mean face I got:

One of the faces morphed to the average that was interesting is this one:

As you can see, the angle of this image was slightly off-center, so the face once morphed looks kind of weird.

Mergeing my own face to the population I get this

It looks really weird because the ratios were off, my image is taken from much further away than the daraset. The mean image morphed to my face looks similarly weird for the same reason:

### My house

I followed the same procedure for the faces of the people in my house. The results are a bit rougher than the larger data sets because there simply arent as many points to average among. Also, I did not remove peoples’ glasses.

My face morphed to the average is pretty weird:

I look way more round…

## Caricatures

I found that the caricatures of the house dataset was pretty wild:

## Bells and Whistles

### Changing my age

I got an “old indian man” from google images, and I made myself old

Color only:

Color and shape:

Shape only:

### Morphing the house

This is my house morphed into eachother fluidly. I made this by creating individual sequences from each house member to the next, then stitching them together

### Weird morphing

See the merge section for weird morphing…

## CS 194-26 Proj3: Face Warping

## Defining Correspondances

This part was fairly simple. To standardize the points, I used IMM’s face annotation, which by the end of this project I had memorized :^(

As stated in the directions, to properly merge two images I triangulated on the average points, not wither image on its own. On top of that, to make the background properly merge I added each of the corners. Looking back, my morphing might have been smoother if I also included:

However, at the end it still looked pretty good. For me and Danny, the average face’s triangulation is this:

## Defining the midway face

To find the midway face between two faces, first I got the average triangulation. Then for each triangle, I defined the start matrix S as

S=⎡⎢⎣y0y1y2x0x1x2111⎤⎥⎦$$S=\left[\begin{array}{ccc}{y}_{0}& {y}_{1}& {y}_{2}\\ {x}_{0}& {x}_{1}& {x}_{2}\\ 1& 1& 1\end{array}\right]$$

where the points of the starting triangle are [yi,xi]$$[{y}_{i},{x}_{i}]$$

and the end matrix E as

E=⎡⎢⎣a0a1a2b0b1b2111⎤⎥⎦$$E=\left[\begin{array}{ccc}{a}_{0}& {a}_{1}& {a}_{2}\\ {b}_{0}& {b}_{1}& {b}_{2}\\ 1& 1& 1\end{array}\right]$$

where the corresponding points of the ending triangle are [ai,bi]$$[{a}_{i},{b}_{i}]$$

Then I define a transformation matrix from S to E as

ST=E⟹T=ES−1$$ST=E\phantom{\rule{thickmathspace}{0ex}}\u27f9\phantom{\rule{thickmathspace}{0ex}}T=E{S}^{-1}$$

This worked pretty well. Now, some issues were happening with singular matrices (happening from a triangle which is actually colinear), however this was solved by returning a zero matrix if S is not invertible.

This turned out pretty well! The transformations for my 400x400 images took around .5s, which isn’t too fast but also not too slow. Here’s the results of the midway between my face and Danny’s:

There’s some tiny discrepancies in the transformation because the angles are different, but if I were to look at that image I’d think that’s Arjun DeVito so I’ll call that a win.

Here’s some more images I got from playing around with different merges/dissolves:

## Perfected

These images were obtained by molding faces to the “perfect” face

Alarmingly happy Danny:

The perfect Arjun:

## Messed up

These images I got while trying to get the transformations right

Drunk Danny:

Drunk chiseled Danny:

Even drunker Danny:

## IMM faces

These faces I got while morphing faces to the IMM annotation dummy image

IMM Annotated danny:

## Thanos

These faces I got from morphing images to Thanos (some with morph factors of over 1 or under 0, creating almost-caricatures)

Thanos Arjun

Arjun Thanos:

Small chin Christian:

Big chin Christian:

Neandrathal Kyle:

Big Chin Mike:

Bigger chin Mike

Biggest chin Mike

Baby Mike:

C h i s e l e d Danny:

## Morph Sequence

Here’s a morph from me to my housemate:

What’s kind of weird about this is that the intermediate faces kind of look like one of our mutual friends…

## Mean population

## FEI Database

The population I chose was the FEI Face database. To find the mean of this db, I first converted the .pts files given to a python array of points, I added the corners of the image, and then I averaged each of the points together to get the average shape. Finally, I morphed each image to that average shape and averaged the images together. Here’s the mean face I got:

One of the faces morphed to the average that was interesting is this one:

As you can see, the angle of this image was slightly off-center, so the face once morphed looks kind of weird.

Mergeing my own face to the population I get this

It looks really weird because the ratios were off, my image is taken from much further away than the daraset. The mean image morphed to my face looks similarly weird for the same reason:

## My house

I followed the same procedure for the faces of the people in my house. The results are a bit rougher than the larger data sets because there simply arent as many points to average among. Also, I did not remove peoples’ glasses.

My face morphed to the average is pretty weird:

I look way more round…

## Caricatures

I found that the caricatures of the house dataset was pretty wild:

## Bells and Whistles

## Changing my age

I got an “old indian man” from google images, and I made myself old

Color only:

Color and shape:

Shape only:

## Morphing the house

This is my house morphed into eachother fluidly. I made this by creating individual sequences from each house member to the next, then stitching them together

## Weird morphing

See the merge section for weird morphing…