Wenbo_Wang_Proj3

Face Morphing

I. Introduction

This is a python program for morphing face images.

The realized functions include morphing face image1 with face image2 , compute the mean face shape and mean face image among a face image group , and morphing face image with the mean face shape and mean face image .

select_points.py was created for selecting/saving feature points in the face image as '.json' files.

process_asf.py was created for reading/saving feature points from the face image group, and calculating/saving the mean face shape as '.json' file.

mean_faces.py was created for morphing each face group image with the mean face shape, while summing/saving mean face image.

morph_sequence.py was created for morphing face image1 with face image2 in different warp_ratio and dissolve_ratio.


II. Morphing Sequence

1. Introduction

The first part that we implement is morphing image1 with image2 in different warp_ratio and dissolve_ratio, where the feature points were selected in each image with the same order.


2. Select Feature Points

In this part we use 'select_points.py' to select feature points in each face image. The feature points was defined as following:

feature_points

The face 'George' and face 'Selfie' with these feature points were shown as following:

George_Selfie

The selected points position with their feature will be saved in the json file, which will be read when we want to use.


3. Morph Image1 with Image2

After selecting/saving face features of 'George' and 'Selfie', we then morph these two images with in different warp_ratio and dissolve_ratio.

The warp_ratio represents the shape ratio between two images, while the dissolve_ratio represents the pixel ratio between two images.
point_morph = (1- warp_ratio) * point1 + warp_ratio * point2
pixel_morph = (1- dissolve_ratio) * pixel1 + dissolve_ratio * pixel2

In detail, using the feature points, the average points between image1 and image2 were calculated using the warp_ratio. And after that, feature triangles were created using these average points, and the transfer matrix T between each triangle's average points matrix and image1/image1 point matrix were obtained. Based on that, each pixel in the average image can obtain its value from image1 and image2 using the dissolve_ratio.

The morphing sequence between 'George' and 'Selfie' is shown below:

Geo_Sel_Morph

The morphing sequence between 'Einstein' and 'Monroe' is shown below:

Ein_Mon_Morph


III. The "Mean Face" Of a Population

1. Introduction

The second part that we implement is calculating the mean face shape and mean face image among a group of faces. The face data base was chosen as the imm_face_db from http://www2.imm.dtu.dk/~aam/datasets/datasets.html. For each mean face, we will morph the 'Selfie' with it to get the morphing sequence.

In this part, the mean face shape and image will be obtained in four steps:
First, read and save the feature points from the '.asf' files for each face image.
Second, use the feature points for each image to calculate the mean face points, i.e., the mean face shape.
Third, morph each face image in the mean face shape, sum them up and then do the average to get the mean face image.
Fourth, morph 'Selfie' with the mean face shape and mean face image to obtain a morphing sequence.

In total, the mean front face, the mean smile face and the mean left face were processed here, as shown below.


2. Mean Front Face

In this section, the mean front face shape and image were obtained, the morphing sequence between 'Selfie' and mean front face was also obtained.

The feature points for front face are shown as below:

front_face

The mean points for the mean face are shown as below:

front_mean_face

The feature points for 'Selfie' and mean front face are shown as below:

me_front_mean_face

The morphing sequence between 'Selfie' and mean front face are shown below:

Me_Mean_Front

The CARICATURE obtained by morphing between 'Selfie' and mean front shape are shown below:

Me_Front


3. Mean Smile Face

In this section, the mean smile face shape and image were obtained, the morphing sequence between 'Selfie' and mean smile face was also obtained.

The feature points for smile face are shown as below:

smile_face

The mean points for the mean smile face are shown as below:

smile_mean_face

The feature points for 'Selfie' and mean smile face are shown as below:

me_smile_mean_face

The morphing sequence between 'Selfie' and mean smile face are shown below:

Me_Mean_Smile

The CARICATURE obtained by morphing between 'Selfie' and mean smile shape are shown below:

Me_Smile


4. Mean Left Face

In this section, the mean left face shape and image were obtained, the morphing sequence between 'Selfie' and mean Left face was also obtained.

The feature points for left face are shown as below:

left_face

The mean points for the mean left face are shown as below:

left_mean_face

The feature points for 'Selfie' and mean left face are shown as below:

me_left_mean_face

The morphing sequence between 'Selfie' and mean left face are shown below:

Me_Mean_Left

The CARICATURE obtained by morphing between 'Selfie' and mean left shape are shown below:

Me_Left

In order to improve the morphing quality, we add 6 hair feature points to morph the hair between these two images. The new feature points for 'Selfie' and mean left face with hair are shown as below:

me_left_mean_face_hair

The morphing sequence between 'Selfie' and mean left face with hair are shown below:

Me_Mean_Left_Hair

The CARICATURE obtained by morphing between 'Selfie' and mean left shape with hair are shown below:

Me_Left_Hair