`
`A Two-Pass Mesh Warping Implementation of Morphing
`
`Dr. Dobb's Journal, no. 202, July 1993.
`
`The files in this directory contain the code necessary to implement a morph (metamorphosis) sequence. The
`
`process is based on a mesh warping algorithm first introduced for a special effect sequence in the movie "Willow"
`
`in 1988 [Smythe 90]. The algorithm, described in [Smythe 90] and [Wolberg 90], has since been used in several
`
`films and commercials. The self-contained code given here is adapted fiom a program listing in [Wolberg 90].
`
`The mesh warping algorithm is used to deform one image into another. The input includes a source iimge 11 and
`
`two meshes, M1 and M2. Mesh M1 is used to select landnmk positions in 11, and M2 identifies their
`
`corresponding positions in the output image. In this manner, arbitrary points in 11 can be "pulled" to new
`
`positions. Although the use of a (parametric) mesh might seem to place unnecessary constraints on the positions
`
`ofthese points, a large class ofusefi11 transformations is poss1ble. It is important, though, that the mesh not self-
`
`interesect in order to avoid the iimge fiom folding upon itself The benefit ofusing a mesh derives from the
`
`simplicity in interpolating the new positions of intermediate points (between the mesh points). A bilinear or
`
`bicubic fiinction can be used. We use a Catmull-Rom cubic spline to implement bicubic interpolation here.
`
`There are two executables that the user can compile: warp and morph. They are created by typing "make warp"
`
`and "make morph", respectively. In "warp", 11 is simply deformed based on the correspondence points given in
`
`meshes M1 and M2. In "morph", a second image 12 is used to designate the target image. Not only is 11
`
`deformed, but it simultaneously undergoes a cross— dissolve with a warped version of12 to create the illusion of a
`
`metamorphosis. The user must specify the number of frames to generate in this transformation. The basic idea is
`
`that each fiame in the transforrmtion uses an interpolated mesh M3 as the set oftarget positions for the input
`
`mesh points. M3 is computed by performing linear interpolation between respective points in M1 and M2. The
`
`"warp" program actually plays an important role here since both 11 and 12 are each warped using M3 as the
`
`target mesh. Thus, 11 is warped using meshes M1 and M3. In addition, 12 is warped using meshes M2 and M3.
`
`Now that the landmarks ofthe source and target images are aligned, they are cross-dissolved to generate a
`
`morph fiame.
`
`FILES:
`
`Makefile:
`meshwarp.h
`warp.c:
`morph.c:
`meshwarp.c:
`util.c:
`catmullrom.c:
`face.bw:
`cat.bw:
`face.XY:
`
`dependency rules for creating "warp" and "morph"
`header file
`main function for "warp"
`main function for "morph"
`workhorse mesh warping code
`image I/O and memory allocation functions
`Catmull—Rom cubic spline interpolation.
`source image
`target image
`source mesh
`
`cat.XY:
`
`target mesh
`
`RUNNING THE PROGRAMS:
`
`WARP:
`
`After you type "make warp", an executable file called "warp" will be created. You can invoke it by typing: warp
`face.bw laceXY cat.XY out.bw
`
`VALEO EX. 1032_001
`
`WMN-cs.ccny.cuny.edu/~wo|berg/abstracts.html#dobb393
`
`1/2
`
`VALEO EX. 1032_001
`
`
`
`Publication Abstracts
`
`You may notice that the output has a distorted grid- like pattern on it. This is not an artifact ofthe algorithm, but
`
`rather it is due to the grid pattern that appears in the input after scanning it fiom a magazine.
`
`MORPH:
`
`After you type "make morph", an executable file called "morph" will be created. You can invoke it by typing:
`
`morph ficebw cat.bw ficeXY cat.XY 10 out
`
`This will create a lO-frame animation stored in files out_000.bw, out_001.bw, out_002.bw,
`
`out_009.bw
`
`COMMENTS:
`
`This code works on grayscale irmges only. Extending the program to handle 3 RGB color channels is
`
`straightforward.
`
`The code is missing a program to help the user create and edit meshes. A good mesh editor is a critical
`
`component to any mesh warping program That code is not given here because it falls outside ofthe scope ofthis
`
`presentation. Instead, sample meshes face.XY and cat.XY are provided.
`
`The reader should be aware that such an interfice should allow the user to control the cross-dissolve schedule at
`
`each mesh point, as well as its position. This permits the intensities in dilferent regions ofthe image to interpolate
`at difierent rates.
`
`REFERENCES:
`
`[Smythe 90]
`
`Smythe, Douglas B., "A Two-Pass Mesh Warping Algorithm for Object Transformation and Irmge
`
`Interpolation," ILM Technical Memo #1030, Computer Graphics Department, Lucasfilm Ltd., 1990.
`
`[Wolberg 90]
`
`Wolberg, George, Digmllmage Warping , IEEE Computer Society Press, Los Alamitos, CA, 1990.
`
`WMN-cs.ccny.cuny.edu/~wo|berg/abstracts.html#dobb393
`
`VALEO EX. 1032_002
`
`2/2
`
`VALEO EX. 1032_002
`
`