In order to compute the midway face, two main steps are needed. First, we need to get a shape that is in between images A and B (in this case, me and Anne Hathaway). We can do this by averaging the corresponding points from each image. Then, we need to compute an inverse warp from the midway shape. This inverse warp allows us to grab a pixel from the midway shape, and figure out which points in A and B will contribute to that pixel. Thus, we construct our image "backwards". We do this inverse warp and lookup for each triangle in the Delaunay triangulation of the averaged points. Then, we can average the colors from A and B when we add them to our constructed image.
Once we have some code for the midway face, it's not much harder to construct the entire morph sequence. Rather than use a .5 and .5 weight for each image A and B, we slide this paramater across the range [0, 1]. In my code, 0 corresponds to getting the raw B image, and 1 corresponds to getting the raw A image. You could vary the parameter for shape and color, but I kept them in sync together.
We can also use these methods across multiple faces, to average them together. Here, I used the Danish scientist data set and averaged together the "1" pose faces. The result looks very plain, since averaging removes all the uniqueness about people! Once we have this average shape and color, we can do fun things, like morph me into their shape, or morph them into my shape. (It doesn't look that great, unfortunately).
Normally, we keep our parameters between [0, 1] in order to get an interpolated image between A and B. However, we could also extrapolate by using a value outside this range! This will "accentuate" the differences between A and B more. It's similar to the unsharp sharpening method from the last project.
For my creative bit, I decided to make a morph of a beloved character, Harry Potter, as he aged over the years of his adventure. These three pictures span 7 years of Harry's life, but approximately 10 years of actor Daniel Radcliffe's.