|Picture A||Picture B|
I first use plt.ginput to record all corresponding points of these two faces:
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:
By passing in different fractions to the target shape and pixel-wise average fraction, we can construct a sequence of face morphings.
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.
By average all mean-shaped faces together, we arrive at the mean face of all population.
My face extrapolated 1.5 from smiling population mean
Making my face smile (best fake smile I’ve ever had):
Class morphing video (Third one is me):