In this project, we create a 'morph' (a warp of image shapes and a cross-dissolve) animation of one face transitioning into a different face. We compute the mean (extrapolated) face of a population of faces and use it to synthesize new faces. Additionally, we generate a video showing the morphing process from one image to another. The dataset used in this project is the FEI Face dataset, which contains 400 images of faces. Link to the dataset
compute_delaunay
to get the Delaunay triangulation of the average points.
Here is the original A and B images as well as the image of the mid-way face that you got.
In this section, I implemented the function `morphed_im = morph(im1, im2, im1_pts, im2_pts, tri, warp_frac, dissolve_frac)` which returns a morphed image for given warp and dissolve fractions.
First, images `im1` and `im2` are warped to the average shape determined by `warp_frac`. Then, they are cross-dissolved based on the `dissolve_frac` to produce the final morphed image.
A sequence of images is generated using a for loop that iterates through different values of `warp_frac` and `dissolve_frac`, appends each morphed image to a list, and saves the list as a GIF using the PIL library.
In this part, I am using face images in FEI Face dataset, and there are provided points for each image stored as pts file.
I first read the images and points, and then calculate the average points of all the images to get the triangulation in order to warp each img to the avg img
Then dissolve the images use for loop get the final result. I normalized the image to make sure the result is good.
After get the average face, I aligned George's face to the mean face, to get face warped into the average geometry, the average face warped into the img geometry.
This part is similar to the previous section. The average points are calculated using the formula: `points = mypoints + a * (avg_face_points - mypoints)`, where `a` can be less than 0 or greater than 1.
I find a average face for chineseMale, and then warp my face to the average face.
I selected three of my photos from different ages and morphed them into a GIF.