This project explores the use of triangulation and morphing to change the appearance of photos.
Given: Two photos Output: An image that represents the “midpoint” or average of the two
To accomplish this, I selected a series of points on each image, focusing on areas that most defined each photograph. Each point in the first image, had a corresponding point in the second image. I then found the intermediate points by taking the average of each corresponding coordinate. A Delaunay triangulation was performed on the intermediate points, and each image was warped to the intermediate shape by taking pixel values from triangles in, say, IMG1, and mapping them to corresponding triangle pixel areas defined by the triangulation on the intermediate points.
Final midway image = warped_img1 * 0.5 + warped_img2 * 0.5
The factor of 0.5 is to average the color values, so that the final result is both the average of the colors and shapes of the two images.
Displayed above are the controls points selected for each image.
Me
Midway
My friend Ashley
Given: Two photos Output: An animated gif that morphs from IMG1 to IMG2 in 45 frames
Creating a morph between two images uses a procedure extremely similar to the techniques for producing a midway face; the only difference being the dissolve_frac
and warp_frac
used. dissolve_frac
refers to how much color in each image shows up in the resulting blend, while warp_frac
refers to how much of the shape of each image comes through in the blend.
To create a morph sequence, I essentially created a series of “midway faces” with different dissolve_frac
and warp_frac
values. Frame 0 was the same as IMG1, and frame 45 was the same as IMG2. In between, both dissolve_frac
and warp_frac
decreased by 0.022 each time (starting from 1 and ending at 0).
Given: Images from a certain population (girls/guys/young/old/etc) in a dataset Output: The average face of the whole population
To create the average face of a population (I used the Danish dataset), I took all the corresponding data points of each image and calculated the average, to get the mean face shape. Then I warped each individual image into the average face shape, using the techniques employed in face morphing. Finally, the average image was produced by summing up all the pixel values of each image and taking the average.
Here are a few samples morphed to the average Danish male face shape:
Original
Warped to average shape
Original
Warped to average shape
The average Danish male
Here are a few samples morphed to the average Danish male face shape:
Original
Warped to average shape
Original
Warped to average shape
The average Danish female
I also played with warping between the average population's shape and mine.
Average Danish female
Average female warped to my geometry
My original image
Me warped to the average female's geometry
Given: An image of me, the average Danish female Output: A caricature of my face
To produce a caricature of my face, I computed the difference between the average Danish female points and the points in my image, multiplied it by some constant α, and added that to the points in my image. I then warped my face to the calculated shape.
As I increase α my eyes become noticeably wider and my face more square. As I decrease α my eyes become much more narrow and my face more elongated.
α = -1.5
α = -0.8
α = -0.5
α = 0.5
α = 0.8
α = 1.5
To try to make my image more female (or male), I took images of the average Chinese actor and actress. In order to accomplish this, a desired face shape and color is required, as both differ among genders.
Average Chinese actor
Average Chinese actress
Desired face shape = my points + α * (female points - male points)
A negative alpha makes the result more male, and a positive alpha makes the result more male. This holds throughout this entire process.
To get the desired color, all the images involved must be warped to the same shape first. After this is completed, the desired color can be computed as follows:
Desired color = my pixel values + α * (female pixel values - male pixel values)
Below are my results with different α values. You'll notice that the results get more outlandish and exaggerated as the absolute value of the alpha value increases.
Shape morph
Color modification
Complete modified image
Shape morph
Color modification
Complete modified image
Shape morph
Color modification
Complete modified image
Given that I'm enhancing myself with respect to the average of all Chinese actresses it makes sense that my skin becomes much paler in these images. Further, since actresses have a tendency to wear make-up, images where the coloring α is higher create the illusion of me wearing make-up as well.
Shape morph
Color modification
Complete modified image
Source Acknowledgements: Bell icon courtesy of Stanislav Levin.