10.14.2011

Face Morph || Mesh Warping


Overview

So this is my small part of a larger movie we're creating in Computational Photography Class. Essentially, I'm creating a morph of two similar images such that one seamlessly flows into another. A morph is a simultaneous warp of the image shape and a cross-dissolve of the image colors. The cross-dissolve is the easy part; controlling and doing the warp is the hard part. The warp is controlled by defining a correspondence between the two pictures. These are done by hand and include important facial features that should be aligned/preserved in order to facilitate the illusion. (i.e. eyes, mouth, chin).

The Algorithm

Correspondences + Triangulation

First we calculate the Delaunay triangulation for each of the user supplied points. In order to ensure the most even morph, the set of control points we use is actually the average of the ones for the two images. Since Delaunay only associates vertices with triangles, this can be applied to both images.


Affine Transformation

The next step is to cacluate a transformation matrix to transform the triangles from the first image into those of the second. An Affine transformation matrix preserves the collinearity relation between points and contains skew, scale and aspect ratio changes.

Cross Dissolve + Morph

Lastly, we cross dissolve the two faces morphed to a warped average while slowly increasing the warp factor, generating a smooth animation. I was surprised how much power the Cross Dissolve algorithm I chose had over the final image, since it was such a small part of the overall code (literally one line!). After several failed attempts, the one that looked the nicest followed the form of Img1 + (some cross dissolve factor)*(Img2-Img1).


Face Morph from Alex Wolfe on Vimeo.

No comments:

Post a Comment