**CS294-26 Project 3: Face Morphing**
By Neerja Thakkar
First, we need to define pairs of corresponding points on two images. I defined 35 points, covering the eyes, nose, mouth, face boundaries, and corners of the image.
Once these points were picked, a Delaunay triangulation was computed on the average shape of these two point sets.
Here is a visualization of the triangulation of these points on my face:
Computing the Mid-Way Face
To compute the mid-way face, we need to:
1. Compute the average location of each corresponding keypoint in the two faces
2. Warp both faces into this shape
3. Cross-dissolve the two warped faces
In order to warp, an affine transform is computed between corresponding triangles in the triangulation of the keypoints of a face and the triangulation of the average keypoints.
Then, the inverse of this warp is used to populate the pixels of the warped image with the corresponding values from the original image.
I used nearest-neighbors interpolation for most of my results, since it was fastest as it did not require looping over any pixels, just the triangles.
Here are images of me and my sister, and our mid-way face.
![Me](neerja.jpg width=200)![My sister](nitya.JPG width=200)
![Our midway face](out/neerja_nitya_midway.png width=300)
The Morph Sequence
In order to create a morph sequence, I varied the parameter that controlled the contribution of each set of keypoints to the "average shape", and the
contribution of each image to the cross-dissolve.
This resulted in the following video: https://youtu.be/q_tIlfhOXBs
The Mean Face of a Population
I computed the "mean face" of a population of Danish scientists. I did this by selecting all of the images with scientists in a neutral pose staring
straight ahead, taking the average of the pre-annotated keypoints, and then warping all of the faces into the average shape.
Here are a few examples of what that looked like:
!(out/danish_warped_3.png width=150)!(out/danish_warped_6.png width=150)!(out/danish_warped_9.png width=150)
!(out/danish_warped_12.png width=150)!(out/danish_warped_15.png width=150)!(out/danish_warped_18.png width=150)
!(out/danish_warped_21.png width=150)!(out/danish_warped_24.png width=150)!(out/danish_warped_27.png width=150)
Then, I averaged these warped images to get the following "mean face":
It is very interesting that the average face is clearly male and white - that says a lot about the demographics of this population.
This is the average face warped to my geometry:
And me warped to the average face geometry:
Finally, I produced some caricatures of myself by extrapolating from this mean face. I took the difference in the shape between me and the average Danish scientist,
and then exaggerated this difference with different $\alpha$ values.
![$\alpha=0.5$](out/neerja_car_alpha_.5.png width=200) ![$\alpha=1.5$](out/neerja_car_alpha_1.5.png width=200)
I also tried a negative $\alpha$ value, which was very interesting - an opposite caricature was revealed. For example, before, my smile was flattened and then
even turned into a frown, but now it was increased.
Bells and Whistles #1: Themed morphing video: me over time
I created a morphing video with some photos of me from ages 1 to 5. This was super fun, and although my face changed a lot between some ages, it generally worked pretty well up until the age I got glasses.
These images were used for the video:
![Age 1](child_1.jpeg width=150)![Age 2](child_2.jpeg width=150)![Age 3](child_3.jpeg width=150)![Age 4](child_4.jpeg width=150)![Age 5](child_5.jpeg width=150)
The video can be viewed here:
Bells and Whistles #2: Changing my age
Having looked at some actual baby pictures of myself, I thought it would be fun to change the shape/appearance of my face to an average baby photo and see how it compares.
I changed just the shape by warping my face to the baby's shape. I changed just the appearance by warping the baby's shape to my shape and then