This project involves image morphing in both shape and appearance, as well as creating a mean face of a dataset using Delaunay triangulation. The images for each morphing were of the same size. Once an image shape was warped, the colors of the same image were cross dissolved.
As my face was unfortunately unavailable for this project, I have used George Clooney, Bill Clinton, and John Lennon as my guest faces!
The points in each image were defined by hand using the ginput tool in Python. Each image contained 44 points, with 40 defined by hand and the other 4 added through code, representing the four corners of the picture. The triangulation was then computed using Delaunay triangulation over the mean points of the two images.
Computing the "Mid-way Face"
To compute the mid-way face, I needed to use the average shape of the two faces (calculated in the previous part by taking the mean of each pair of coordinates) to warp and cross-dissolve the original shape and colors of the two images. The pixels of each triangle in the target (mid-way) image are retrieved using the polygon function, which is then used to calculate an affine matrix for inverse warping. The corresponding pixels in the source images are found using inverse warping and the colors cross-dissolved using interpolation.
The Morph Sequence
Creating the morph sequence was very similar to creating the mid-way face. Instead of only using the average points between the original images, shape warping was determined by a fraction that was proportional to the phase of the morph sequence. For example, the fraction would be 0 in the beginning, preserving the first original image and 1 at the end, preserving the second original image. Images in between would be a mixture depending on the value of the fraction. The interpolation of pixel colors is also dependent on the fraction. In this gif there are 21 frames.
Each image was stored in a list, which was then converted into a gif.
The "Mean Face" of a Population
I used the Danish set and took the mean face of all males. I chose to only include the first image of every male as that was the only image with the participant facing the camera directly. The mean face was calculated in a similar fashion to the mid-way face, except each position/color in a single image in the dataset was given a weight equal to its proportion based on the number of images in the dataset.
To warp the shape of an image into another's, I essentially reused the same morph function with slight changes. There are no cross-dissolving colors, and shape is entirely dependent on the target shape. Here are some example images of warping the shape of images in the Danish sample set to the average face.
For my face I am instead going to be using John Lennon's face!
Caricatures: Extrapolating from the mean
To produce a caricature from "my" (John Lennon's) face, I took the difference between the mean and "my" face and added back with a coefficient of 1.5
Bells and Whistles
- Changed the gender/ethnicity of John Lennon's. I found the average shape of an African woman, and found some interesting results!
It was really fun being able to play with different faces and seeing what a mid-way face between them would look like!