# Face Morphing

## Overview

In this project, we produce an image morphing effect on two images by cross-dissolving the colors of the two images and while also interpolating corresponding points on the two images.

## Morphing Images

We first defined corresponding points on the two images and generated triangulations using Delaunay triangulation on the average points from the two corresponding point sets.

The images used in this part were from the data section of this project.

 Face 1 point triangulation Face 2 point triangulation Face 1 mean point triangulation Face 2 mean point triangulation

We then created the "mid-way" face of the two faces. To do this we first warped both of the faces to the mean of the anchor points.

Since we had the Delaunay triangulation for the mean points, we found the affine transform matrix going from each of the mean point triangles to those of the initial image. Each triangles was defined by three points so the transform matrices were found by solving a system of linear equations to map points of one triangle to the other.

Once we had the transform matrices, we found where pixels of the warped image mapped to in the original image to sample the original image pixels. We performed masking using scipy's polygon function to get the coordinates inside each triangle and multiplied by the transform matrix to get corresponding coordinates in the original image. We could then use interp2 to sample the billinearly interpolated color value at the corresponding coordinate to use in the warped image pixel, creating the full warped image.

Once we had the two warped images, we averaged the pixel values to blend the colors and create the final "mid-way" face.

 Face 1 Midway Face Face 2

To create a morph sequence of the two faces, we first needed frames at different points in the transition. Instead of warping the faces to the mean points, we warped them along different interpolation weightings between the two image anchor points. This was done to blend the face shapes. The resulting images were weighted by the same amount and summed to blend the colors.

 Face 1 Morph! Wow! Face 2

I would post a bigger gif, but it would have been too big to upload.

## Mean Face of Population

We then generated the mean face of a dataset of face images. We used the FEI Face Database for our dataset. The dataset contained 400 face images and their corresponding anchor points. We calculated the mean anchor points from the anchor points for all the images, performed image warping to the mean points to align all the faces, and averaged them to produce the mean face.

 To mean face morph Dataset average face To mean face morph

I also used my face for interpolations.

 Population mean My face My face on mean geometry Mean on my geometry Midway me and mean

To create caricatures with accentuated features, I took the points from my face and subtraced the mean face to get the difference points. This difference is then weighted and summed with the mean points to get my face should be warped. The weighting determines how much my own features are accentuated.

 -1 weight 0 weight 1 weight 2 weight

## Bells and Whistles

For the bells and whistles, I decided to change ethnicities to Korean, but in reality I thought it would be funny to morph my face to the mean K-pop star face.

 Me Some mean K-pop male face from Google My face, my/Kpop average geometry Kpop face, my/Kpop average geometry My face, Kpop geometry Kpop face, my geometry Color blending + face warping Only color blending

Moral of the story: make-up is amazing.

### Extra Gifs

 Me to mean Me to Kpop