TP3

Faces Morphing

Saeed Sojasi


Goal of Assignment

The goal of this assignment is produce a morph animation. We will produce a "morph" animation of our face into another student's face. The idea behind face morphing is to transform object A into object B using a set of correspondences such as the location of the eyes, the ears, the nose and the mouth. We will need to define corresponding points between images by manually selecting them. I made my selection in the exact same order as in the website image. We will also use our morpher to create the picture of the average face in the class.

1. Morphing algorithm

The morphing algorithm is composed of the following steps: 1. Defining correspondences. 2. Triangulation. 3. Morph ( Triangles affine transformation and Dissolving). We will need to define corresponding points between images by manually selecting them. For the defining correspondences I made my selection in the exact same order as in the website image. For this purpose I used Matlab function(saveAndDisplayFeatures.m). Once we obtain the corresponding points for each face, we average the shape coordinates to obtain the average face shape. We then compute a Delaunay trianulation to parse the image into triangles. The Delaunay triangulation minimizes the number of triangles that span large regions, which helps prevent non-local warping. I wrote a Matlab function (morphed_img.m) for morphing. This function contains both images, text of images, wraping, dissolve, and triangulation. The purpose of warping the images is to distort the apparent shape of features in the photographs. I calculated the average of feature points of first image and feature points of second image by using wrap_frac. Transformations are useful for increasing and decreasing scale, rotating, translating and performing other modifications. I used an affine transformation to translate triangles to first image and second image (see 'Transformation.m'). 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 (homogeneous transformation). The inverse transformation is used to ensure that eah pixel and only each pixel in the target triangle gets assigned a value. Finally , After the affine transforms are computed, we must now compute the color for each pixel. For each triangle,I computed the inverse affine transform to look up the color associated to each pixel in both images by 'dissolve_frac'. The weight for each image corresponds to (1 - dissolve_frac) and dissolve_frac. By 'dissolve_frac' color computed from the source pixel and target pixel mapping from the same intermediate pixel are used to represent the color of intermediate pixel. There is a question and that is what if pixel comes from “between” two pixels? Anawer is: Interpolate color value from neighbors by using 'nearest neighbor, bilinear, Gaussian, bicubic', I used cubic (see 'ComputeInterpolation.m'). For morphing, the two parameters 'warp_frac' and 'dissolve_frac' should both range from 0 to 1. We need to produce 120 frames, then I set wrap_frac = 0.0083:0.0083:1 to get 120 frames. we first increase the parameter 'warp_frac' to 0.0083 by 0.0083 per step to generate 10 images while keeping the parameter dissolve_frac = 0 unchanged. After that we increase both of them (wrap_frac and dissolve_frac) until we reach to 110 images. after that, we again put dissolve_frac = 0.

1.1 Results

The results of this part are shown below:



2. Computing the "average face"

we calculate the average face of all images. This would involve: 1) computing the average shape, 2) warping all faces into that shape, and 3) averaging the colors together. For computing the average face, the idea is almost the same with some difference. we compute the intermediate shape using all the face images instead of computing the intermediate image between two face images. Then, we calculate the mean color by mapping the corresponding pixel from each of source images to the same pixel in the intermediate image and computing the average mapped color (see 'average_face.m').

2.1 Results

The results of this part are shown below:
For the mean face, it is just an ordinary human that is much closer to a male, because the number of men is much grather than women.

Bells & whistles

For this section I try these ideas:

Results

The results of this part are shown below:

Morphed Jean-François to Saeed:


Thin to fat:


Gollum to Shrek:


Lion to girl:


Young to old:



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


My caricatures by mean face idea:



I produce masculinizing of all my men classmates faces by mean face idea:



I produce feminizing of all my women classmates faces by mean face idea: