home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-385-Vol-1of3.iso
/
d
/
dmorf012.zip
/
DMORF.DOC
next >
Wrap
Text File
|
1992-12-27
|
8KB
|
192 lines
DMORF Rel Alpha 0.12 (12/26/92)
Copyright (c) 1992, by David K. Mason
This is just a brief intro to get you going with DMorf. It's not
a real document or anything.
To run DMorf, you MUST have:
1) A VGA monitor (regular VGA is sufficient... DMorf works only
in 640x480x16 mode)
2) At least a '286
3) A mouse with a microsoft-compatible driver
To accomplish any serious work with this program, you SHOULD have:
1) A numeric coprocessor... it DRAGS without one
2) Plenty of XMS (EMS is not useful) unless you're working with
teeny pictures.
During the warping process, DMorf creates a buffer
big enough to hold one entire picture, in RGBa (32-bit)
form. That means 256000 bytes if you're working with
320x200 pictures, or 1,228,800 for 640x480, or 1,920,000
for 800x600, or 3,145,728 for 1024x768.
(Note: there are two versions of dmorf in the package...
dmorf.exe, which runs in real mode and only allows access
to conventional memory, and dmorfx.exe, which runs
in 286 protected mode, and allows access to up to 16M
of extended memory... dmorfx requires some extra files
that are not included in this archive... they're
called "DPMI16BI.OVL" and "RTM.EXE", and they're in another
archive file called "DTAMEM.ZIP" which you should be able
to find in the same place you found Dmorf.)
To get started with DMorf, type "DMORF <file1> <file2>"
(or "DMORFX <file1> <file2>" if you're using the protected mode
version).
The files can be TGA (16, 24, or 32, compressed or uncompressed),
Vivid IMG, or GIF. The two files don't have to be in the same
format, but they do have to have the same dimensions.
DMorf doesn't currently check to make sure they have the same
dimensions, so if you mix 'em up, you might get REAL odd results,
run-time error, or both.
The only type of output DMorf creates is compressed Targa-32
files. VPIC and PICLAB have some trouble reading the output files,
because the run-length packets span lines.
DTA can read 'em okay, though.
DMorf will then read and display the two pictures in side-by-side
windows. If you only gave one filename, then it'll display
that picture twice.
It scales 'em so they'll fit in the windows.
Then, a mesh is laid over the two pictures.
In this program, a mesh is represented by a bunch of horizontal
and vertical lines. The points where they intersect can be
adjusted.
Initially, there are lines on the four edges of the picture,
There are always the same number of mesh points defined in the
two pictures, though they aren't always in the same places
unless the meshes are locked.
To add a new line to the mesh, move the mouse cursor to the
border around one of the pictures (which one doesn't particularly
matter). Click the button at the point where you want the line
added. (If the cursor is on the top or bottom border, a vertical
line will be added, and if it's on one of the sides, a horizontal
line will be added.)
To move a vertex, put the mouse cursor over the intersection
of two lines, press the button, and move the mouse.
Let go of the button when you've got the point where you want
it. DMorf will try to prevent you from overlapping lines.
It's possible to defeat it with weird angles. It's best if
you don't, however.
Here's what the other controls on the screen do:
Just Warp: In Morph mode, the program will map points from
picture #1 toward picture #2, and from 2 toward 1, and
cross-fade. In Warp mode, it'll just map points from
#1 toward #2, with no fade.
Not too surprisingly, Warp mode takes half the time
that Morph mode does.
Spline meshes:
When your points are all located where you want them to be,
and you tell DMorf to go ahead and morph, DMorf figures out
which points to map where by drawing spine curves between
the vertices.
If you turn this control off, it'll draw straight lines instead.
Reasons to use slines instead of lines: the warp often looks
a whole lot better.
Reasons to use lines instead of splines:
(1) Splines sometimes go haywire, with curves going every which
way, overlapping, and (gasp) sometimes even passing beyond
of the picture borders
(2) You don't want something curved when it warps
(3) lines are faster than splines.
Smooth resampling: In smooth mode, DMorf interpolates
new pixel values from all source pixels that should
contribute... if you turn this control off, it just
grabs a the closest pixel value.
Nearest neighbor, in other words. The results
in smooth mode look massively better than dumb mode.
But dumb mode is massively faster. Dumb mode would be
useful in test runs, but don't use it for real stuff, 'cause
it looks like crap.
The Mesh colors "R" control: sets the red component of the color
used to display the control mesh.
The Mesh colors "G" control: sets the green component of the color
used to display the control mesh.
The Mesh colors "B" control: sets the blue component of the color
used to display the control mesh.
The Frames control: tells DMorf how many pictures to create.
If you're in Morph mode, then this represents how many tween
frames to create. In warp mode, this number includes a
fully-warped final frame.
The Swap button: swaps the meshes between the two windows.
The Copy 1->2 button: copies the mesh from window 1 into
window 2.
The Copy 2->1 button: copies the mesh from window 2 into
window 1.
The Splines button: gives you a preview of what splines for the
current mesh points would look like. If you're using
"Spline meshes" mode, make sure you use this button once in a
while to make sure the splines aren't going nuts.
The Zoom buttons: display just one of the images, much larger.
This gives much finer control over the mesh control points.
The Save button: saves your meshes and settings to a control file.
The Load button: loads a control file. Type the filename right the
first time or you'll get a run-time error and get dumped out to
DOS.
The Go button: causes DMorf to start morphing.
The Abort button: Changed my mind. Get me out of this program NOW.
The escape key does the same thing.
If all this makes no sense, just start messing around with the
program. Once you figure out how to add new points to the mesh,
the rest of the interface is pretty intuitive.
Credits:
The warping and morphing algorithms come from George
Wolberg's book Digital Image Warping.
The image scaling and spline code come virtually unchanged from the
same book (except for translating it from C to Pascal).
I ripped the line drawing routines off from PC Magazine's
book Turbo Pascal 6.0 Techniques and Utilities, by Neil Rubenking.
I don't remember what other places I stole stuff from.
Much is actually my original work, though.
Thanks to the Compuserve GRAPHDEV forum gang, and the Graphics
Alternative BBS gang for their suggestions, and various bugs
they've helped me identify.
Stuff I'm going to add or change (sooner or later):
1) Deletion of mesh lines.
2) A better way of adding mesh lines.
3) Proper handling of the alpha channel. Right now DMorf takes
the alpha byte from TGA-32s into account, but I haven't
bothered to make it work with them right.
Since I don't actually have any test files with real alpha
info in them.
I'm also going to have to write a little program to add alpha
info to pictures (a seed fill to alpha out the background
is a method suggested in Foley & Van Dam).
And write a program to do compositing (or add that capability
to DTA).
4) Or, forget that alpha stuff and add some kind of mechanism for
cropping out the background.
-- David K. Mason
P.O. Box 181015
Boston, MA 02118