Part A: Morphing

To morph a face into another, the first step is to define correspondences which is done with the function provided. Key points are used to locate face features and also four corners of the images to have the background. Using the morphing function, each frame is built to make up a video sequence starting from the first image to the second.
Key points of the source and destination images are used to calculate their average. Delaunay triangulation is done with average key points.
The morphing function computes the warped image that is a combination of both images using the warp fraction. As a result, the affine transformation between the average image and keypoints of both images is calculated. Now that we know the corresponding position of the pixels in each image, using the inverse transformation, we should go back to each image from the average image to get the color of that pixel. Since triangles may change size during transformation, there is no guarantee to find an exact match for each pixel. Here is the point that interpolation comes in, to help us find the right corresponding pixel. By retrieving the color from two images, the color of average image is calculated with dissolve fraction.
I have used the function provided to make the videos with 80 frames in total and 15 frames per second.


Results from some images found on the internet:





And my own photos:


Part B:

1. Average Face

In this part, first we detect the key points of all the images. Then, their mean is calculated to have the average face 'shape'. Using the points of average shape and key points of each image in the database, images are morphed with the warp fraction of 1, so that all the faces are aligned and can be averaged to get the average face.

The average face and average shape calculated from the key points selected manually:


And using the feature detection function provided:



The results for the Utrecht database:


Bells & whistles

In the average face of images with smile and without smile, we can see the differences not only in the shape of lips, but in other face features.


2. Masculinizing and feminizing

After dividing images into male and female, we can calculate male and female average faces.


Male Average Face Female Average Face

And you can see my face morphed to average face of men and women of the Utrecht database. With bigger distortion, my face shape is more like the average shape calculated.

Male Face, distortion = 1 Male Face, distortion = 0.7 Female Face, distortion = 1 Female Face, distortion = 0.7

Bells & whistles

I have morphed my photo to the average face with and without smile, then used them as source and destination to make a video sequence. By the way, since the difference between smiling average face and the one without smile is not so much significant, the morphing sequence is not very interesting.


My face with smile My face without smile