Face Morphing

Henley Zhang
October 6, 2024

Introduction

emir

This project aims to determine how to morph faces using a mesh of corresponding points to transform pixels in a smooth way. We can use these techinqies to find the average face of a population, along with caricatures and gender changing.

Defining Correspondences

Approach

First, two similar images are chosen, and made to be the same size. Then, corresponding points were selected using this link.

https://cal-cs180.github.io/fa23/hw/proj3/tool.html Then, the points are trangulated using the Delaunay triangulation. The images are then aligned by finding the dx and dy values that scipy.spatial.Delaunay.simplices

Results

catheral monastery tobolsk tobolsk

Computing the Midway Face

Approach

The 'average shape' was generated by averaging the corresponding points of the two images. Then, a trangulation was applied on these midway points. An affine transformation function was defined, and we calculated a linear transformation matrix to apply to the triangles. For each trangle, coordinates are created using sk.draw.polygon, and are multiplied by the inverse transformation matrix. The color of the image was determined by blending the images, but an interpolation function was defined to determine the final color of the pixel.

Results

church

Morph Sequence

Approach

A wrapper function was created to accept a decimal rather than the fixed 0.5 used in the previous section. This function is then called on a range of values from 0 to 1.

Results

catheral

Mean Face of a Population

Approach

The average shape of the population was calculated by averaging the corresponding points of the images. Then, each image is warped to the average using the morphing function from the previous part. All of the morphed images are then averaged to create the final average face.

Results

church

Average face

emir

Morphing me to avg face

emir

Morphing avg face to me

Some example images morphed to average

church church church

Caricatures

Approach

The same morph function was used, but the average shape formula was changed to caricature = scale * (face - avg_face) + avg_face.

Results

catheral

Caricature with scale 1.5

catheral

For fun I tried scale 3 and had an interesting result.

Bells and Whistles

Approach

I tried to change the gender of my face by blending it with an average asian female face I found online.

Results

church

Shape Only

emir

Appearance Only

emir

Both

church

Morph Gif