Face Morphing
Aaron Hsu
Code Description
The goal of this project was to take an image of ourselves and to create a video that shows
our face slowly morphing into another person. Today, I, Aaron Hsu will morph into one of my classmates, Andrew.
We first start with an image of my handsome face and define our correspondences using cpselect.
In doing so, the points that I select on my face to use as feature points correspond to Andrew's as well.
Using the procedure described here: points, point_labels.
we label our faces - including facial outlines, eyes, eyebrows, nose, ears and mouth features.
After labeling our correspondences, we save the points and create a Delaunay Triangulation.
In order to prevent our morphing to change in triangulation as triangles become too skinny, we use a midway triangulation between
my own correspondence points and Andrew's points.
Here are our original face pictures and Delaunay triangulations.
We also add 4 new points to our correspondences so the entire image is changed (rather than just some parts of the image).
Now observe our mean triangulation. This helps us better keep track of triangulation labels as we
identify which triangles are being changed as our faces morph.
After the triangulation, we implement the morphing function.
Given our mean triangulation and correspondences, we start with a warping fraction and dissolving fraction
that increments per frame as we slowly morph. The warp fraction is extract a weighted average of our facial shapes
while the dissolve fraction is used at the end to use a weighted average to blend the colors of our faces together.
For every triangle in the triangulation, we take that triangle and find the corresponding triangles in the input shape, final shape, and intermediate (warped) shaped.
We calculate the inverse affine warp matrix which we'll be using later to extract colors at the original pictures
to be used in the intermediate pixel locations based on how triangles are warping.
Using mytsearch by David Martin and interp2, we can look up which triangles contain a pixel
and when applying the inverse warp matrix we interpolate pixel coloring.
We do this from both the input and base images and we use the dissolve fraction to mix
the colorings together.
Correspondence
|
|
Me - Aaron Hsu |
Andrew |
Here's a link of my face morphing into Andrew's.
The video consists of 60 frames (and thus 60 substeps) each
Morphing Movie Link
Mean faces
|
Mean Face |
This average face was taken from 13 classmates, including mine, since many classmates didn't have
their points up in time. I couldn't average classmate pictures if their points were up as it would
inaccurately skew the triangulation.
Here's a link to my face morphing into the mean face (30 substeps)
Morphing To Mean Movie Link