CS194 Project 3 Kehan Wang
Faces Used for Morphing
Picture A |
Picture B |
|
|
Defining Correspondences
I first use plt.ginput to record all corresponding points of these two faces:
Computing the “Mid-way Face”
Given two corresponding triangles from the two faces, I rearrage the coordinates and use np.linalg.solve to solve for the 6 degrees of freedom of the affine transformation matrix.
Once we have the computeAffine, we can map triangles from the target face shape to the original face shape. This is the inverse affine transform we are using, so that for every pixel in the target shape, we’ll find the corresponding value by mapping it to the original face, and interpolating for its value.
Now, we just need to find the target shape - the midway shape. We find the midway shape by average corresponding points of our two faces.
So, the whole pipeline is: find the midway shape; compute affine from target to each face; find each pixel value of the target shape using the affine transformation; average two transformed faces.
Here are the results of my mid-way morphing:
Midway Shaped Faces
Midway Face Combined
The Morph Sequence
By passing in different fractions to the target shape and pixel-wise average fraction, we can construct a sequence of face morphings.
Mean face
I used FEI face databse. By finding average shape of all images, I was able to compute the mean shape. Now we can morph all images into this mean shape.
Examples of faces in mean shape
By average all mean-shaped faces together, we arrive at the mean face of all population.
The Mean Face
my face warped into the average geometry
the average face warped into my face geometry
Caricature
My face extrapolated 1.5 from smiling population mean
=>
Bells and whistles
CS194 Project 3 Kehan Wang
Faces Used for Morphing
Defining Correspondences
I first use plt.ginput to record all corresponding points of these two faces:
Computing the “Mid-way Face”
Given two corresponding triangles from the two faces, I rearrage the coordinates and use np.linalg.solve to solve for the 6 degrees of freedom of the affine transformation matrix.
Once we have the computeAffine, we can map triangles from the target face shape to the original face shape. This is the inverse affine transform we are using, so that for every pixel in the target shape, we’ll find the corresponding value by mapping it to the original face, and interpolating for its value.
Now, we just need to find the target shape - the midway shape. We find the midway shape by average corresponding points of our two faces.
So, the whole pipeline is: find the midway shape; compute affine from target to each face; find each pixel value of the target shape using the affine transformation; average two transformed faces.
Here are the results of my mid-way morphing:
Midway Shaped Faces
Midway Face Combined
The Morph Sequence
By passing in different fractions to the target shape and pixel-wise average fraction, we can construct a sequence of face morphings.
Mean face
I used FEI face databse. By finding average shape of all images, I was able to compute the mean shape. Now we can morph all images into this mean shape.
Examples of faces in mean shape
By average all mean-shaped faces together, we arrive at the mean face of all population.
The Mean Face
my face warped into the average geometry
the average face warped into my face geometry
Caricature
My face extrapolated 1.5 from smiling population mean
=>
Bells and whistles
Making my face smile (best fake smile I’ve ever had):
Class morphing video (Third one is me):
Link