Main page # Project 3 ## Description The main goal of this project was performing different operations on aligned images of faces with the help of lists of corresponding points, depicting main features of the face. Some of the coolest tasks were: - creating a gif of personal face morphing into another face - changing personal race & appearance with the help of average faces Throughout the project I used the following tool for marking corresponding points: https://cal-cs180.github.io/fa23/hw/proj3/tool.html I also used three photos of me (here are they in original form):
## Part 1 Here's how I marked corresponding points on me and clooney (zoom to see white squares better).
Then as recommended I performed triangulation with the help of `scipy.spatial.Delaunay` on the average points. Here's the triangles rendered over me and clooney:
## Part 2 To get midway face of me and clooney, I followed lecture slides (lecture "Image Warping and Morphing") closely and warped images to the midway form by warping each corresponding triangle. When calculating new pixel values, I used Bilinear Interpolation as it was shown in the lecture. Original images:
Here's the midway face and also midway face with triangles:
Midway face
Midway face with triangles
## Part 3 To do the morphing operation, I modified my midway_face function to support dissolve_frac parameter (0.5 by default), so the resulting face is formed as imgA_warped_to_midway_form * dissolve_frac + imgB_warped_to_midway_form * (1 - dissolve_frac) Inside morph function I calculated current facial form based on warp_frac parameter: imgA_pts * warp_frac + imgB_pts * (1 - warp_frac) This would allow me to call morph function with different warp_frac and dissolve_frac parameters to get morphing steps. Here's some examples of morphing steps:
Morphing step 7/45
Morphing step 12/45
Morphing step 20/45
Morphing step 29/45
Morphing step 40/45
I got the following gif of morphing from 45 steps with 30 fps: However I didn't like the gif produced with suggested parameters as it doesn't show initial and final face clearly and also doesn't loop! So I created a more beautiful gif with looping effect and longer pause on the first and last frame: ## Part 4 For part 4 I used FEI Face Database, specifically frontal images spatially normalized pack. https://fei.edu.br/~cet/facedatabase.html I computed average face separately for still and smiling images. And also separately for still/smiling and male/female images. I had to label images male/female as it was not obvious from the dataset. I got 100 male and 100 female images as expected. Some examples of morphing faces to computed average still face form:
1a original face
1a morphing to average face

25a original face
25a morphing to average face

35a original face
35a morphing to average face

41a original face
41a morphing to average face

72a original face
72a morphing to average face

Here are the average faces I computed:
Average still face
Average still face for male
Average still face for female
Average smiling face
Average smiling face for male
Average smiling face for female
I found it interesting how male and female average faces look different in hair form (female has hair on the sides, male doesn't).
Here's my original face, my face warped to average face as well as average face warped to my face:
My original face
My face warped to average face
Average face warped to my face
It's clear that my face has bigger tilt to the bottom in the photo than photos from FEI database. This is why average face warped to my face looks more tilted to the bottom. This is especially visible in the next part! ## Part 5 As I already mentioned, my face has bigger tilt to the bottom in the photo than photos from FEI database. So caricaturing my face really exaggerates this tilt and moves my face to the lower part of the image. Caricature effect facial pts are calculated as: avg_shape_pts + (points_oleg - avg_shape_pts) * alpha, alpha - weight of the caricature effect. Here's my original face, and my caricature face for different weight of the caricature effect:
My original face
Caricature face for alpha=0.1
Caricature face for alpha=0.3
Caricature face for alpha=0.7
Caricature face for alpha=0.9
Caricature face for alpha=1.3
Caricature face for alpha=1.5
Caricature face for alpha=2.0
## Bells and Whistles (COOKIES) For the bells and whistles I did the task of changing my ethnicity and gender. I used average face of korean male and average face of chinese female from the following website: https://pmsol3.wordpress.com/2009/10/10/world-of-facial-averages-east-southeast-asia-pacific-islander/ After marking corresponding points I morphed and warped my face to the average facial forms of korean male and chinese female. I also warped their faces to my facial form. Original images:
My original face
Avg face of chinese female
Avg face of korean male
Here are the results:
My face morphed to avg of chinese female
My face morphed to avg of korean male
My face warped to avg of chinese female
My face warped to avg of korean male
Avg face of chinese female warped to my
Avg face of korean male warped to my
I think the results turned out better than I expected. And super fun! I also really liked how the difference in eye form and face width is clearly visible on the warped images.