Fun with Morphings!
CS194-26 Image Manipulation and Computational Photography
Part 1: Defining Correspondences
Part 2: Computing the "Mid-way Face"
Part 3: The Morph Sequence
Part 4: The "Mean face" of a population
Part 5: Caricatures: Extrapolating from the mean
Bells and Whistles Summary
Morphing is a simultaneous warp of shape and cross-dissolve of color for two images. Cross-dissolve is relatively easy, since we can just weigh the pixels from two images differently. However, warping is hard as we need to define (hand-labeled) correspondence and triangulate the images, and interp2 the pixel values. In this project, we will look into the different steps in this amazingly interesting technique
This part is quite straighforward, as I just fire up Matlab and use the cpselect functionality to define the correspondance.
Defining correspondences with Matlab's cpselect
This part, I first implemented the A = computeAffine(tri1_pts,tri2_pts) function, which compute the affine transformation from one triangle to the second, with the geometric method mentioned by Prof. Efros in lecture
Affine transformation: geometric intuition
Then I implemented morphed_im(im1Name, im2Name, im1Pts, im2Pts, TRI, warp_frac, dissolve_frac) function which morph two images based on the corresponding points, triangulation, and warp/cross-dissolve fraction
The Morph Sequence was generated with 19 frames between myself and George Clooney. I generated the gif to go both forward and backwards
The Morph Sequence between myself and George Clooney
I chose the Danes Dataset to do this part of the project. It was a bit difficult to parse the *.asf files to the desired format and label my image consistently with their labeling. I wrote my own helper function read_points(asfname) to parse the asf file and morph_mean(dirname, gender) to perform the actual morphing.
Another difficulty I encountered was that, the parts of image that is not covered by any triangle is morphed very poorly. But after I add the four corners to all the cooresponding points, the issue was resolved.
We can morph some faces in the dataset to the average shape
Original image: 18
18 morphed to shape of mean face
Original image: 35
35 morphed to shape of mean face
Original image: 40
40 morphed to shape of mean face
Here are some examples of my image, when playing around with the Danish Computer Scientists
Selecting corresponding points
Original image: myself
My face morphed to the geometry of mean face of the Danes (ohoh)
Mean face of the Danes morphed to geometry of my face (hmm)
Apparently, I am not that Danish at all. lol
So apparaently it is possible to produce a caricature of my face by extrapolating from the population mean.
Caricature with 20% increase in my geometry
Caricature with 50% increase in my geometry (sad lol)
I computed the mean of male, and female Danish Computer Scientists respectively, found the difference in geometry and applied the same shape transformation to my geometry to get the "shape only" transformation
Female mean face
Male mean face
"Shape only" transformation
"Color only" transformation
Both shape and color transformation
The picture submitted