The goal of this project was to accomplish a morph between two images. That was done by establishing a correspondence between the two images. The mapping should align key facial features such as eyes to eyes, mouth to mouth, chin to chin and so on, on both images. Using these keypoints a triangulation could be made from which the main goal of the project could be derived, morphing images into each other.
The first task was to define these corresponding keypoints and performing the triangulation. Firstly the images were cropped into the same size and the faces were aligned to some extent. These images are displayed below.
Then a provided online tool was used to set the correspondences and then the triangulation was made using the scipy.spatial.Delaunay function in python. This resulted in the triangular meshgrid displayed below.
The next task was to compute the mid-way face of the two images, i.e the midway morph of the two images. This was done by computing the average shape of the triangulation with the following formula: $$\text{Average points} = \text{Carl's points} * 0.5 + \text{Jacob's points} * 0.5$$ Then the inverse of the affine transformation matrix was computed between the triangles in the images. Using the skimage.draw.polygon function, masks were made for every triangle. These masks were then used to warp all pixels inside the triangular mask instead of looping over every pixel. The triangles were warped using an inverse warp. Lastly, a cross-dissolve was used to blend the colors of the images. The results are presented down below.
The next task was to create a sequence of the warps so you can see how one image gradually turns into another. Using different fractions of the warping and cross-dissolving coefficients \( \in [0,1] \) this resulted in a morphed sequence with 45 different images and a frame rate of 30 fps. I also made a morph sequence between Mark Zuckerberg and Matthew McConaughey. The results are shown below.
Now it was time to compute the average face of a population. The dataset I chose only consists of 37 images of Danish people where 30 are male and 7 are female. The average shape of Danish males and females respectively, were computed and then the images were warped into this shape. Below are some examples.
To compute the average face, all of the warped images were added together and then by calculating the mean of these images the average was computed. This was done for males and females separately. As you may notice the average male face looks a bit smoother and in my opinion more computer generated. This is probably due to the fact that the dataset for the males is more than four times as large and thus a more averaged image could be achieved.
After having computed the average Danish faces my face was warped into the average Danish male face and the average Danish male face was warped into mine.
In the last part a caricature from my face was made by extrapolating from the population mean in the previous part. I tried using different alphas, below are two examples of this.
For the bells and whistles I tried to change my gender using the average female Danish face. This was done by both warping my face to the average female Danish face but also dissolving the images. The result was not too great though unfortunately. One reason for this is that all of the images of the Danish females were taken with a green background which makes the dissolve a lot worse.