Project 3 - Face Morphing

by Razieh Toony

GIF-4105/7105 Photographie Algorithmique by Jean-François Lalonde

Project Details

The goal of this project is to generate a morph animation such that my face is smoothly morphed into my classmate's. Morphing combines both geometry and colouring of objects from multiple images. The first and second frames are the photos of my face and her/his, respectively. The intermediate frames of the animation are the morphed images with varying degrees features of my photo and my classmate's.

Approach

A morphed image is achieved by a combination of a warp with a cross dissolve. Basically, the most difficult part of morphing is that how an in-between image can be generated from two given images. The in-between image is derived by interpolating the position, shape and colour of corresponding control points of the two images.
The images should not be uniformly warped but it can be accomplished by a set of transformations. The transformations are useful to increase and decrease the scale, rotation, translation and other modifications. So, to have a successfully warpping process, many transformations sould be applied to discreet sections of the photo.

Triangulation

Generally, there would be some corresponding areas between two images. In the humain face, there are several logical corresponding points including the mouth, the nose, the chin, the eyes, and the boundaries such as the edges of hair. To preserve points and ensure correspondence, they are manually selected for each image. Once the correspondence points are defined for an image, it can be partitioned by a triangulation of those points. The following images depicted the mesh of two photos based on the average mesh between those two photos (The average`s control points contribute 50% of each image)

Triangulation

Since the triangles are based on the logical correspondence points, it is assumed that a transformation of one region in a triangle can not be applied to the entire triangle and we need to define local transformation for each triangle. This change of basis is an affine transformation.

Once the transformation between two triangles is found, the points in one can be transformed to form the new triangle. This transformation represnets that how the faces are warped. The warping effect is performed by an inverse transformation, where each pixel in the target triangle is determined based on the transformation between the triangles. The inverse transformation is used to ensure that each pixel in the target triangle is assigned by only one value. The initial and the final images are warped triangle by triangle by applying the affine transformation to each pixel of triangles.
Hence, in the implementation, I Initially divided the image into three channels and I applied the transformation over the geometric of pixels. Then, I exploited it for tunning these three channels. The R, G and B channels are finally combined together using cat function of Matlab.

Compute Affine Transformation

Hint: Affine Transformations Computation

Cross-dissolve

After performing the coordinate transformation for each of facial image, the control points of these images are matched. To complete face morphing, we need to perform cross-dissolving operation which is a simple Alpha Blending method. Cross-dissolving can be described by the following equation :
Output-image(x,y) = Alpha (First-image) + (1-Alpha) (Second-image) , 0 <= Alpha <= 1

Video Sequence

Result

Mean Face

1- Computing the average shape
2- Warping all faces into that image
3- Average the colours together.

Mean face of all students

Mean face of all men

Mean face of all women

Bells and Whistles

I : I tried image morphing with other images.
1- Age Progression (Harry Potter)
2- Animal
3- Different Position (Car)

Other Images

In the left morphing image of dog, I just chose the control points of its face but in right image, the control points also consist some parts of its body. So, some geometric transformations are visible.

II : I used the mean face idea to produce caricatures, masculinizing and feminizing.

Caricature

Masculinizing

Feminizing

Since we have fewer female students in the class, the mean face of all students is very similar to the mean face of all males. Also, I think the artefacts of the whole morphing images can be due to the control points selection. For example, in the car morphing, the view point is not the same. Obviously, I could not choose the exact same aspects. We can conclude that the efficiency of morphing method in this way, completely hinge on the control points selection.