home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
World of Shareware - Software Farm 2
/
wosw_2.zip
/
wosw_2
/
CLIPART
/
MERGE-IT.ZIP
/
MERGEIT.DOC
< prev
next >
Wrap
Text File
|
1991-06-12
|
28KB
|
516 lines
20 May '91 dld
DOCUMENTATION FOR MERGING HAND SCANNER IMAGES WRITTEN TO PCX FILES
By making a simple frame + edge guide to scan images with, you can more easily
merge scanned sections of a document which are in the "PCX" image file format.
The program MergeIt (TM) can merge scanned images together either horizontally
or vertically. Automatic merging will a good job of joining scanned image
sections. The resultant merged image is displayed as it is built, enabling
progressive user trimming.
Whole letter or legal sized page images can be built from hand scanned
sections that are very nearly indistinguishable from the whole page
flat-bed scanners.
MergeIt will display the merged image regions on Hercules, EGA, and VGA video
systems. The automatic merge process will be most successful if a mechanical
straight edge is used on the left side to guide the hand scanner. In
particular, any twisting of the scanner will distort the image in ways that no
software can correct. With a modest amount of preparation, MergeIt will make
full page documents that are readily faxable or importable into painting and
drawing programs that use the PCX format.
The shareware version of MergeIt is limited to merging 2 image sections
and the merged output image file is named "ImageOut.PCX".
The registered version of MergeIt will merge up to 5 image sections and
does not restrict the output file name. See "Register.Txt".
*** See "Frame.Doc" for more information on building a scanning frame. ***
For descriptive purposes and orientation, scanned image sections will be
described as being generated by moving from the top to the bottom of a frame
which holds the image being scanned. The image may be in a portrait or
landscape orientation. Reference blocks (see next section) are at the top edge
of the image, the regions to be cut and merged are at the left and right sides
of the scanned image. The top and bottom image edges just need to be cut. The
image is scanned right to left, with the scanned image file numbering
starting on the right. (If the image scanned is an ordinary sheet of text laid
on its side in landscape orientation, the top of the text should be on the
right).
Automatic merging of scanned image sections is dependent on the detection and
measurement of black reference blocks on the top edge of the image sections,
within 1.5" of the left and right edges. These black blocks must
exist on a white background to enable clean detection. "Frame.Doc" gives more
information on how to set this up.
Using MergeIt comes more naturally with a little practice. Since it is an
unusual mixture of mechanical setup and software, give yourself some time
to become fluent in adjusting and using it. The reward of having full sized,
merged images from almost any printed source for the modest cost of a hand
scanner (and MergeIt!) will make it worthwhile.
Enjoy!
Image Analysis for Locating Reference Blocks
The top 1.0" of the scanned image is analyzed for left and right reference
blocks within 1.5" of the left and right edges. The detected reference blocks
must have a minimum height of 0.1" to be valid. For calculations, the bottom
0.01" of each block is ignored and the next 0.08" of the blocks are used to
calculate critical left and right block edges and block widths. The bottom
0.01" is skipped to avoid averaging spurious partial block image lines.
Methods of Cutting and Merging the Vertical Left and Right Edges of Images
The left edge of a scanned image is always processed the same way. The left
edge of the left top reference block acts as a vertical cutting line; the
image is cut with respect to this. The user may specify an offset from this
line.
The right vertical edge may be cut in one of three ways:
a) The simplest is a simple cut determined by a user-specified width with
respect to the left cut line. This cut is usually done for the right-most
scanned image since its right edge is also the edge of the document. In
this case, the width is specified as the 2nd entry on line 6 in the
initial values file.
b) The most commonly used merge method is probably by reference block merge.
The method takes the width of the left reference index block located in the
image to the right and then utilizes the width of the right block in the
current image to calculate how to cut the right edge so that the width of the
merged block across the seam is equal to the original block width (which is
user specified). For each image section you wish to merge this way, the
reference block width is the 3rd entry on the corresponding line in the
initial values file.
c) The 3rd method is a mirror image of the way the left edge is cut. The
right edge of the right reference block determines a vertical cutting line.
The user may specify an offset from this. This method might be useful if
you have a page of text in narrow columns (such as a magazine). Using a right
white edge while scanning will cause a clean cut and merge of the adjacent
text columns. For each image section you wish to merge this way, the
offset is the 4th entry on the corresponding line in the initial values file.
Top and Bottom Cutting of Images
The top cutting line of an image is determined from the bottom edge of the
reference blocks. If one block is lower than the other, it determines the
edge. The height of the cut image is user specified and is calculated
downwards from this top cutting line.
Command line switches (optional)
1) File name (with path if necessary) of initial values file. Ex:/image3.ini
2) Merged image filename to override name in initial values file.
Ex: MergeIt /d:\paint\eschrB.ini /printA.pcx
Use the initial values file "eschrB.ini" in the directory "d:\paint"
and call the merged image file "printA.pcx".
Initial Values File
MergeIt requires an initial values file, written as a simple ascii text
file, to run.
*** Before trying to understand these entries and their meaning, I ***
suggest you look at "Frame.Doc" (if you haven't already) for
a physical orientation.
In addition, you might want to see the line by line image
analysis described in the latter part of "Tutor.Doc".
A sample initial values file to look at and use is "EschrB.Ini"
Line by line description:
(line indices are for description only, do NOT include in actual file)
{Starting on line 5, all floating point numbers are inches,
+ is in the left direction on the scanned image section}
1)Scan#.PCX {Scanned Image Filename, "#" denotes increment position
in name, scanned images move from right=>left}
2)1 3 {Index to start input files at, number of images to merge
i.e. scan1.pcx, scan2.pcx, scan3.pcx }
3)PageOut.PCX {Merged Image Filename to use}
4)25 12 0 {a) Dark Threshold (maximum % of dots that can be white
in the averaging of dot segments, in this case up to
3 out of 12 dots could be white),
b) # Dots to use in averaged dot segments, a number
<2.0 is interpreted as a dimension in inches to
average (and the appropriate number of dots are
calculated). If an odd number of dots is specified,
it is incremented to an even number.
c) millisecs to view each line of analysis, called
Msec-Debug, see below}
5)0.0 8.4 4.0 3.5 General image cutting values:
{a) Top edge offset to trim down from for all image
sections,
b) height of outputed merged image,
c) scanned image width,
d) spacing between reference blocks}
6)0.0 3.5 0.0 0.0 0.0
Values for cutting and merging the first scanned image
(the rightmost image):
{a) Inches to trim left image edge, with reference to
straight edge white/black boundary
b) Width to cut image at right edge. If this value
is 0.0 then the program will cut the right edge
by the next method and value ("c")
c) Set right edge to merge with adjacent image on
the basis of total width of black index block which
is read here. The width is determined by the frame
setup you use. If this value is 0.0 then the program
will cut the right edge by the next method
and value ("d")
d) Cut right edge on the basis of the black/white
boundary. Use this number of inches to shift left/
right from boundary. This value may be 0.0
e) Top Line Offset for this image only. To be added to
global offset above.}
7)0.0 0.0 1.0 0.0 0.0
Values for cutting and merging the next scanned image
(to the left of the above image):
{a) Inches to trim left image edge, with reference to
straight edge white/black boundary
b) Width to cut image at right edge, if 0.0 then
program will read next value..
c) Set right edge to merge with adjacent image on
the basis of total width of black index block which
is read. The total width is determined by the
frame setup you use. If 0.0 then program will
read next value..
d) Cut right edge on the basis of the black/white
boundary. Use this number of inches to shift left/
right from boundary. This value may be 0.0
e) Top Line Offset for this image only. To be added
to global offset on line 5.}
8)0.0 0.0 1.0 0.0 0.0
Values for cutting and merging the next scanned image
(to the left of the above image):
{a) Inches to trim left image edge, with reference to
straight edge white/black boundary
b) Width to cut image at right edge, if 0.0 then
move on to..
c) Set right edge to merge with adjacent image on
the basis of total width of black index block which
is read. Set value from frame setup. If 0.0
then move on to..
d) Cut right edge on the basis of the black/white
boundary. Use this number of inches to shift left/
right from boundary.
e) Top Line Offset for this image only. To be
added to global offset on line 5.}
Display of image line analysis (Msec-Debug):
The value of Msec-Debug determines how much reference block analysis
is displayed. If Msec value=1, then a summary of each image's analysis is
displayed after all lines in an image section are analyzed.
If Msec value is >1, then the individual line analysis
is shown for the # of Millisec specified in addition to the previous
information.
If Msec value=0, then only the actual image segments will be
displayed for user trimming. If Msec value is <0, then image viewing and
user trimming will be bypassed. The image will be simply automatically
merged on the basis of the reference block analysis.
Error Messages When Running MergeIt
Errors may be divided into 3 groups: system, input and analysis, and cutting.
System: the program will halt
If there isn't enough memory to run the program (the program grows somewhat
in size as more images must be merged).
If an initial values file or image file is not found.
If there is no more disk space to store a combined image file.
Input and Analysis: the program will halt
If the initial values file has invalid numerical entries.
If the image files do not appear to be PCX files or PCX scanner files.
One or both reference blocks may not be detected in the top left and right
regions that the program analyzes. The left block is always required for
determining the left vertical cutting line. The right block is not important
if vertical cutting method 1 is used. Analysis will be finished more quickly
if a right block is detected, however.
The bottom edge of one or both reference blocks may never be reached within
the limits of the top region which program analyzes.
Cutting
After determining the desired boundaries for the cut image, including any user
offsets, the image available may be smaller than needed. This is most commonly
the case if a user offset extends a cutting edge beyond the image. The program
prompts you to approve cutting adjustments if image available is too small.
Special Input Image Considerations
Most documents to be scanned and merged will be on white/off-white paper and
will be easily distinguished by the program from the reference blocks. This
is necessary to determine the top edge of the cut image. If the document is
too dark, a plain white border of 1/16" or more may tacked to the top of the
document (perhaps by simply attaching a plain piece of paper to the back).
The user may then specify a top edge offset to obtain the desired cut image.
If the document to be scanned is a simple page of full width text, then
merging is straightforward.
If the images' edges to be merged just contain adjacent lines of text or text
and picture then you will probably get a very satisfactory merge the 1st time,
automatically, without any user trimming.
If you are attempting to merge a diagram or picture across image sections then
you may sometimes find the automatic merge to be unacceptable. The strength of
MergeIt is its absolute repeatability (if the same images and initial values
file are used) and its predictability if the initial values file is changed
with respect to user offsets. This allows you to make shifts in the merge
process down to the single dot row level. By keeping a record of small trim
adjustments, you can make small corrections to the initial values file to
improve the automatic merge process. MergeIt can NOT automatically compensate
for the following scanned image errors:
a) One image is rotated with respect to the other. This is usually caused
by twisting the scanner unit while scanning. It can be corrected by using
a left vertical guide edge and attaching a lower guide bar to the scanner
handle. No software can correct this well.
b) One image is shorter than the other. While moving the scanner, the
tracking roller on the bottom got stuck or skipped. Perhaps there is some
dirt on it that is changing its diameter (and therefore possibly changing
the apparent distance being scanned). Perhaps you moved over the image too
quickly and lost proper registration. Typically hand scanners show a dot
registration variability as they roll of 1 or 2 dots/inch. The steadier
and more repeatable the image scanning stroke, the better. MergeIt allows
you to view the merge process and trim the images to compensate for this.
*** I strongly suggest that you introduce yourself to trimming images by ***
making use of the tutorial. Read "Tutor.Txt".
Viewing/Trimming Merged Edges
Generally:
Initial feedback of user trim commands is given through beeps. A single, short
medium pitched beep indicates more feedback is necessary to finish the user
trim operation. A double medium-high pitched beep indicates is a completed trim
operation. All image trim commands may be repeated before the modified image
is processed and redisplayed. Entering a simple <cr> terminates the trimming
process and starts redisplay and/or merging. The end of user trimming and the
restarting of image processing is signaled by a triple beep. A longer,
low-pitched single beep indicates an error or trim limit has been reached.
Global shifts of one scanned image with respect to another is accomplished
with the cursor keys. Internal scanned image adjustments (deleted/added lines
and dots) are initiated with the insert/delete keys. Up to 32 insert/delete
trim operations may be performed on the merged image if not rotated. If
rotated, up to 32 operations may be performed on each scanned image section.
Rotated Image Trim Process:
The top and bottom margins of each rotated & scanned image will be displayed.
100 image lines will be displayed for each margin, and a short beep will sound
after each margin is fully displayed. At this time some modifications are
possible.
Bottom Edge Trimming:
The user may shorten the image up to 16 lines. The viewed areas of the image
may be shifted left or right. There MAY be a few image lines to add to the
initially viewed image. Essentially, trimming should be done to erase small
sections of text or picture at the bottom edge. It is NOT possible to shift
the bottom edge of the image left or right since the upper edge has already
been merged to the previous scanned image.
Top Edge Merging:
The user can shift the top edge of an image left or right up to 16 dots, image
permitting. Note that the width of the image is maintained so that the motion
limits may be less than 16 dots if the scanned image doesn't have this much
extra border width. The image to be merged may also be moved down by as much
as 16 lines (again image border permitting). Moving this image down will cause
more of this image to be included in the composite image. This image may also
be moved up, cutting off more of this image at the merge boundary. There is no
limit to this upward motion.
BOTTOM EDGE TRIM COMMANDS:
Cursor Up/Down: Will subtract/add lines to the bottom of the image displayed
that will then be merged with the top edge of the next
section.
Alt-V: Change a viewed image region. 2 more choices follow:
Choose: Home/End=>Select which viewed region to shift. Home is on the left,
End is on the right.
Choose: Home/End=>Move the selected view region to the adjacent left/right
section of the image.
<cr>: Ends user input command and executes desired action. If no command is
entered since last <cr> then the merge process continues.
'G' : Continue merge process without viewing.
'V' : Review current image.
TOP EDGE TRIM COMMANDS:
Cursor Up/Down: Will subtract/add lines to the top of the current image
at the boundary with the previous image section's bottom edge.
Insert/Delete: Insert/delete dots at the marker location for all lines in
the current displayed image section.
Command options:
Home/End: Move marker 1/8 of image width to the left/right.
SpaceBar: Move marker 1 dot to the right. (Cleared by Home/End);
Esc: Exit the insert/delete operation.
<cr>: Perform operation at current marker location, then exit operation.
'-' : Delete last command.
Left/Right cursor: Move the image left/right with respect to the above
(previous) image section edge.
Alt-V: Change a viewed image region. 2 more choices follow:
Choose: Home/End=>Select which viewed region to shift. Home is on the left,
End is on the right.
Choose: Home/End=>Move the selected view region to the adjacent left/right
section of the image.
<cr>: Ends user input command and executes desired action. If no command is
entered since last <cr> then the merge process continues.
'G' : Continue merge process without viewing.
'V' : Review current image.
Unrotated Image Trim Process:
Each output image line is made up of image lines from all scanned sections.
Therefore some changes of image merging require that the merging process
restart from the beginning.
Initially, the right most 2 merge regions are shown, with the vertical
boundary between the sections centered. A small marker is shown below the
right region, denoting the image on the right side of this merge region as the
image merge region that may be trimmed. Home/End keys may be used to change
the image section to be trimmed (home is to the left). The cursor keys may be
used to shift the selected region. Note that the up/down keys must shift the
whole scanned region (at both merged edges). The left/right keys only shift
the image at the edge that is selected. The shift limits are determined by the
limits of the scanned images. The viewed merge regions may be shifted
left/right (if there are >2 regions) by use of the Alt-V key followed by home
or end keys. Home will shift the viewed regions 2 regions over to the left (or
1 if that is the max shift). The end key will do likewise in the right
direction.
UNROTATED IMAGE TRIM COMMANDS:
These two commands will force a complete remerge processing of the image:
Cursor Up/Down: Will shift the selected image up/down.
Left/Right cursor:Move the selected image left/right with respect to the
selected merge boundary.
Home/End: Select which viewed merge regions are modified. Home moves to the
left, End to the right.
<cr>: Ends user input command and executes desired action. If no command is
entered since last <cr> then the program continues with the merge
process.
Insert/Delete: Will allow user to insert/delete individual lines in an image
region in view. The region to modify is previously selected by home/end keys.
Command options:
PgUp/PgDn: Moves a marker up/down 8 lines which marks which line to change.
SpaceBar : Moves marker down 1 line.
'+': Performs desired operation at marker location but doesn't exit
process.
<cr>: Same as '+' but also ends process.
'-': Delete last line insert/delete command.
BkSpc: Delete earliest line command (as defined by the lowest line index).
Alt-V: Change the merged regions shown. This command is only valid if more
than 2 merge regions exist.
Choose: Home/End=>View merge regions to the left/right of the currently
viewed regions. If possible, two new regions will be shown; other-
wise, one new region will be shown in the direction of shift
(Home shifts left, End shifts right).
'V' : Force a redisplay of the current region. This will automatically be
performed if a line insert/delete command was added to the viewed
region.
Note that redisplay does NOT automatically occur if the insert/delete
operation was performed only at the very bottom of the viewed region. This
command may be used to override a previous "G" command.
'B' : Rebuild the entire merged image without viewing until the current
view region is reached. Useful if rebuilding is required by previous
trim commands.
'R': Restart the merge process with full view, modification capability.
'G': Continue the merge process without continuing to view or trim.
Memory Issues
The program occupies about 150K bytes. A programming criterion was to enable a
rotated merge of scanned image sections that are 4" wide and 9" long at
300DPI..and do this in the 640K DOS space. This requires 405K bytes to store
the image to be rotated, which requires at least 555K bytes of free
memory, not an impossible goal. If the scanned images do not require rotation
when merging, then memory requirements are much less and won't be a concern.
If there is insufficient memory available for rotation, then you may specify
storage to disk (in the same directory as the other image files). For the
sake of time (and your hard disk!) I recommend you do this on a RAM
disk. First put the scanned images to be merged on the RAM disk before
starting MergeIt.
Normally, when MergeIt does a rotated merge, it stores the complete bottom
lines of each image (sections of which are viewed) so that the user may change
the merged sections being viewed even when the top of the next image is being
processed. If memory is tight, MergeIt may ask you if you want this temporary
storage to be done to disk. If you say "no", you will only be able to change
the merged sections to view when just the bottom edge of a scanned image
section is visible, i.e. once the top of the next image section is visible,
you can't change what regions you see.
Fatal Program Error Message Codes
2: File not found
3: Path invalid
4: Too many files open. Perhaps the config.sys file doesn't specify enough
open files. Set to "Files=20".
5: File could not be opened, perhaps directory is full.
101: File could not be written to since the disk is full.
106: Numerical entry in initial values file is incorrect.
203: Insufficient memory to store image.
-3: Graphics error, driver file not found. Appropriate file (Herc.BGI,
EgaVga.BGI,...) not in directory where executable program is located.
Integrating Scanning Operation and Merging (Registered users only)
ScanIt is a small shell program to integrate the scanning and merging process.
It executes the necessary image scanning utility to create the image
section files and then runs "MergeIt" to put the image sections together.
The process may be repeated for up to 100x, generating merged image files
with names such as page1.pcx,page2.pcx,...
While designed around the Logitech ScanMan DOS scanning utility, it was
written to be flexible enough for adaptation. It MUST be started in the
directory where itself and ALL executable files are located. The
initial values file may be in a different directory. The generated
image files may be stored in yet another directory.
For full documentation, see "ScanIt.Doc".
For the LogiTech Scanner, the DOS scan utility is called Scan.Exe
and is run from the DOS command line with a line such as:
Scan.Exe scan1.pcx 4IN 9IN
where the scanned image is written to the pcx format file "scan1.pcx"
with a width of 4 in. and a length of 9 in.
Typical Input Line for use with this scan utility
(best written in a batch file):
Scanit.exe Mergeit.exe /image3.ini Scan.exe [filename] [width]IN 9IN
The phrase "[filename]" is the location where ScanIt will place the scanned
image filename to be created by scan.exe. when it executes the utility.
The phrase "[width]" is the location where ScanIt will place the desired
width to scan (in inches) when it executes scan.exe.
Both of these entries are generated from the initial values file.
Typical Batch File:
cd D:\PAINT
D:
Scanit.exe mergeit.exe /e:\scan\image3.ini Scan.exe [filename] [width]IN 9IN
Legal Notices
MergeIt COPYR. 1991 Dennis DiBart ALL RIGHTS RESERVED
Disclaimer of Warranty:
This software and documentation are sold "as is" and without warranties as to
performance of merchantability or any other warranties whether expressed
or implied. Because of the various hardware and software environments
into which this program may be put, no warranty of fitness for a particular
purpose is offered.
Good data processing procedure dictates that any program be thoroughly
tested with non-critical data before relying on it. The user must assume
the entire risk of using the program. Any liability of the seller will be
limited exclusively to product replacement or refund of purchase price.