光阴冢

We make choices and life has a way of making us pay for them.

Morphing in Action

Jul 27, 2017   # Image Process  # Algorithm  # Code 

Morphing

Definition

It is an image processing technique typically used as an animation tool for the “metamorphosis” from one image to another. It should not be confused with “morphological” impage processing operators which detect image features.

General Idea of Morphing

The process can be divided into two parts: image-warping and cross-dissolving . The first step is to make the result correct, and the second is to make the process smooth.

Relatively, the cross-dissolving method is easy in implementation, we just need to calculate the states in the process linearly. The major problem is to find the algorithm to warp two images.

Ways of Warping

  • Forward Mapping

    This way looks at the source image first, and then move pixels to correct place in the generated image separately.

  • Reverse Mapping

    It consider the destination image, and sample the appropriate pixels from source image.

Algorithms of Morphing

There are 2 published algorithms.

  • Mesh Warping

    The mesh warping, obviously, uses mesh to warping two images.

    The mesh (can be nonuniform) is defined in a matrix which contains the control points’ coordinates(x, y). And the meshes of images should be in same size, so that we can map every point in it.

    The images will warp from one image to another accroding to a map function defined by the meshes.

  • Feature-Based Image Morphing

    The field morphing algorithm uses lines to relate features in the source image to features in the destination image.

    Different from the first algorithm, it uses lines instead of points. Also, this algorithm uses the reverse warping to warp the images.

    We can define a set of line-pairs in the source image and desitination image, and with the lines transforming, transform each pixel coordinate by a rotation, translation, and a scale, thereby transforming the whole image.