Face morphing
In Chapter 1, Getting Started with Image Processing, we discussed a naive face morphing technique based on simple α-blending, which looks terrible if the faces to be morphed are not aligned.
Â
Let's conclude the last chapter by discussing a sophisticated face morphing technique, namely Beier-Neely morphing, which visually looks way smoother and better than α-blending for non-aligned faces. Here is the algorithm:
- Read in two image files, A and B.
- Specify the correspondence between source image and destination image interactively (by computing facial key points with PyStasm) using a set of line segment pairs. Save the line segment pair to lines file.
- Read the lines file. The lines file contains the line segment pairs SiA, SiB.Â
- Compute destination line segments by linearly interpolating between SiAÂ and SiBÂ by warp fraction. These line segments define the destination shape.
- Warp image A to its destination shape, computing a new image A'.Â
- Warp picture B to its destination shape, computing...