This project aims to determine how to morph faces using a mesh of corresponding points to transform pixels in a smooth way. We can use these techinqies to find the average face of a population, along with caricatures and gender changing.
First, two similar images are chosen, and made to be the same size. Then, corresponding points were selected using this link.
https://cal-cs180.github.io/fa23/hw/proj3/tool.html Then, the points are trangulated using the Delaunay triangulation. The images are then aligned by finding the dx and dy values that scipy.spatial.Delaunay.simplicesThe 'average shape' was generated by averaging the corresponding points of the two images. Then, a trangulation was applied on these midway points. An affine transformation function was defined, and we calculated a linear transformation matrix to apply to the triangles. For each trangle, coordinates are created using sk.draw.polygon, and are multiplied by the inverse transformation matrix. The color of the image was determined by blending the images, but an interpolation function was defined to determine the final color of the pixel.
A wrapper function was created to accept a decimal rather than the fixed 0.5 used in the previous section. This function is then called on a range of values from 0 to 1.
The average shape of the population was calculated by averaging the corresponding points of the images. Then, each image is warped to the average using the morphing function from the previous part. All of the morphed images are then averaged to create the final average face.
The same morph function was used, but the average shape formula was changed to caricature = scale * (face - avg_face) + avg_face.
I tried to change the gender of my face by blending it with an average asian female face I found online.