First, I defined pairs of corresponding points for the two images using the correspondence tool from the CS180 website. In order to lessen the potential for triangle deformations, I took the average of the two sets of points and used the averaged set to create the Delaunay triangulation. I have displayed both of the images I will use for the face morphing along with their respective keypoints below:
Before computing the entire morph sequence for the two faces, I computed the average face between the two faces. In order to do this, I performed the following steps: 1. I first computed the average shape using the average of each keypoint location in the two faces. 2. I then warped both faces into the average shape. To do this, I defined the function computeAffine(tri1_pts,tri2_pts) to compute affine transformation matrices A between two triangles from each of the images. This transformation matrix was then used to implement an inverse warp of all pixels. I used sk.draw.polygon to find all points within a given triangle and applied the inverse transformation matrix to the points. 3. Lastly, I averaged the colors of the two faces together using a dissolve fraction of 0.5.
To create a GIF of the transformation from one image to another, I computed 45 different frames with steadily increasing warp and dissolving factors. I also implemented the morph(im1, im2, im1_pts, im2_pts, tri, warp_frac, dissolve_frac) function, which takes in two images, their respective keypoints, the triangulation structure, the warp fraction, which controls the shape warping, and the dissolve fraction, which controls cross-dissolving.
For this part, I used faces from the FEI Face Database. I first computed the average face of the dataset which is shown below. I did this by computing the average face shape of the whole population, then morphing each of the faces in the dataset into the average shape, and finally computing the average of all of the warped faces.
Then, using the average face I computed, I warped some example faces to the shape of the average face. The results are shown below:
I then warped my own face to the shape of the average face, and I also warped the average face to the shape of my own face:
To create a caricature of my own face, I extrapolated from the population mean I calculated in the last step by setting the warp fraction value to be outside the bounds of 0 and 1. I used an alpha value = 1.5:
For this part, I decided to change the ethinicity of my face to be that of a Caucasian person. The images I used for this part are shown below:
First, I morphed my face to the face shape of the Average English Male using the techniques in the previous parts:
Next, I morphed my appearance to that of the Average English Male. First, I warped the Average English Male face to my own face shape. I then averaged together my own face with the warped Average English Male:
Lastly, I morphed both my shape and appearance to that of the Average English Male: