Zhenkai Han

In this project, I learned how to morph face. The idea is simple: linear interpolation and extrapolation. With triangulation and some linear algebra knowledge, I can improve morph a lot and create funny pictures and generate mean face for population.

I wrote my own little tool (set_points.py) to define pairs of corresponding points on the two images. I labeled "my face" in same order and similar position. For triangulation, I used *Dalaunay* provided by *scipy.spatial*

I computed the average shape with linear interpolation. In mid-way face, Its wrap fraction is 0.5. For wrapping face, I need to wrap source triangles to averaged triangles one by one. From my triangulation on start face, I can get indices of each triangle with method *simplices* of *Delaunay*. I did following job for each triangle in triangulation:

Since I defined points in order, so the indices also was the indices of corresponding triangle in the averaged points and I could get the three points which define the triangle. With method *skimage.draw.polygon*, I could convert the three points of triangle to a matrix contains all coordinates of points in the averaged triangle (mask). I wrote a function *compute_affine* to get the transformation matrix *T* which transforms source triangle to destination triangle. With linear algebra, the inverse of *T* helped me to get a matrix contains all coordinates of points in the source triangle. So I could fill the averaged triangles region with color of points in source triangles.

At last, I added all filled averaged triangles together to get mid-way face.

The morph sequence is simple: computing the "mid-way face" with different warp fraction and dissolve fraction. To get the best morphing result, warp fraction and dissolve fraction should be the same for one "mid-way face". After that, I made these "mid-way faces" into an animated gif with python library *imageio*.

The mean face is simple: it is the mean of all faces. It is similar to computing the "mid-way face". But for each images, their warp fraction and dissolve fraction are the same: one over how many face in total.

I used dataset from Danes. Since this dataset mainly contain male's face, I calculate the mean face with all pictures matched regex **-1m.jpg*. I also read their defined points in corresponding asf file.

Geometry of a face can be seems as its triangulation. To warp face A into geometry of face B, I need to define points in the same order and number as points in face B so that A's triangulation can match B's triangulation. This time warp fraction is 1 to use B's geometry completely; Dissolve fraction is 0 to use A's color only.

Extrapolating from the mean face is simple: warp fraction should be over 1. It is easy to think that it will make feature of the mean face more obvious.

I downloaded average face of west African women.

I picked some photos of George Clooney from here. After reading his biography, I think everything will be good in the future!