Face Morph Gallery.

A morph is a simultaneous warp of the image shape and a cross-dissolve of the image colors. The project was to make face morphing algorith, using techniques like Delaunay Triangulation and finding mid-face points to morph from original image to the target one. The warp is controlled by defining a correspondence between the two pictures, which maps eyes to eyes, mouth to mouth, chin to chin, ears to ears, etc., to get the smoothest transformations possible. I was also inspired to do morphing on some of favorite self-portrait artworks by Frida Khalo, Picasso, Rembrandt, and Jan van Eyck.

description of gif
description of gif
description of gif

Algorithm

1. Define Correspondences. I wrote the function (pick_correspondences) to manually pick the keypoints from the face, levaraging ginput from the matplot library. I then applied Delaunay triangulation to not produce overly skinny triangles for a triangular mesh.

2. Compute "Mid-Way" Face. The best apparoach was to to compute the triangulation at a midway shape (i.e. mean of the two point sets) to lessen the potential triangle deformations. Mid-way face was computed with the average shape (a.k.a the average of each keypoint location in the two faces), warping both faces into that shape, and averaging the colors together. The main task in warping the faces into the average shape was implementing an affine warp for each triangle in the triangulation from the original images into this new shape. This involved computing an affine transformation matrix A between two triangles. I iterated through all the triangles pairs and computed an affine transformation matrix between, using the produced matrix along with some interpolation to move the pixels between triangles and implemented an inverse warp of all the pixels.

description of gif

3. Create Morph Sequence. Lastly, do the same thing for each frame (45), gradually changing the shape of the imaage faces.

description of gif
description of gif
description of gif

Mean Population

I wasn't able to finish the part completely, but I made the average face population for the Danes annotated dataset. Using the keypoints already annotated on the data I computedthe average face shape of the whole population or some subset of the population (happy females) and morphed each of the faces in the dataset into the average shape. Later on, I was facing weird issues with my laptop and was going through some personal issues, which prevented me to fully complete the assignment (which feels not good). But, I hope to compensate lost points with future projects.

description of gif