To define the correspondences, I mapped out points on both an image of myself and an image of my friend Rohan (thanks Rohan!). Following the definition of points, I used scipy's delaunay function to compute a triangulation of points for the halfway image. Below are the images with the points plotted on them, as well as the triangulation:
|
|
To perform an affine warp backwards, we must solve for the inverse transformation matrix. To do this, multiply the point matrix for image 1 with the inverse of the point matrix for image 2. Using this, we can find corresponding points for a polygon of img2 within img1. Using this, we can then compute the midway image, which is shown below:
|
|
For this problem, I computed the mean of the Danes dataset by averaging the correspondence points for all images in the set. I then morphed each individual image into the average shape. Following this, I summed all the images then averaged them to produce the mean image:
|
|
|
|
|
Following this, I morphed my face into the shape of the average face in the dataset, and also morphed the mean image into the shape of my face:
|
|
To create a caricature of myself, I morphed my image to the shape of said image modified by the difference betweem itself and the average shape of the Danes dataset. As a result, the image is being warped to a shape that incorporates itself, but has been caricaturized by the inclusion of the average from the dataset:
|
For the bells and whistles portion of this project, I took the average image for an infant and morphed myself to it. I separately morphed myself to the shape of the baby face, to the appearance of the baby face (done by morphing the baby to myself with the colors), and to both:
|
|
|
https://i.pinimg.com/originals/27/0b/d5/270bd529a4ea04cee6ed85d66335827e.jpg