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:

  1. Read in two image files, A and B.
  2. 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.
  3. Read the lines file. The lines file contains the line segment pairs SiA, SiB
  4. Compute destination line segments by linearly interpolating between Siand Siby warp fraction. These line segments define the destination shape.
  5. Warp image A to its destination shape, computing a new image A'. 
  6. Warp picture B to its destination shape, computing a new image B'.
  7. Cross-dissolve between A' and B' by dissolve fraction α.
  8. Save the resulting image to a file.

The implementation of this algorithm is left to the reader. The following figure shows a face morphing implementation with the PyStasm library. The images in the first row are the source and the target images, and the last row shows two intermediate average face images. As can be seen, using this implementation, the morphing is very smooth and visually pleasing:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.41.235