VGA512: Image Processing Package on the PC ========================================== G A W West School of Computing Science Curtin University of Technology Perth, WA 24 February, 1995 Introduction ============ The VGA512 Image Processing package aims to give the user an insight into how to process images using various well known simple techniques. It is designed to utilise VGA (video graphics adaptor) hardware, dynamic and EMS (Expanded Memory System that is LIM compatible) memory and a mouse. This software was developed from a package originally written by Dr T J Ellis at City University, London in 1988, much modified for a number of framestore cards by Drs T J Ellis and G A W West in the intervening years. Images by their nature take up a large amount of disk and memory. A small image 256x256 pixels at 8 bits per pixel requires 64k of memory. A 512x512 image of 8 bits per pixel requires 256k of memory. The package overcomes some of these problems in the following way. If the chosen memory is dynamic, it uses as much of the main memory (640k) as possible for images while leaving enough for heap/stack allocations and the Turbo graphics library. If the chosen memory is EMS then it allocates all of the expanded memory for images. It is crucial when assessing image processing software to be able to display images. This requires a grey scale display. The VGA standard has one mode for displaying an image of 320x200 pixels at 64 grey levels per pixel. However most VGA cards have enhanced graphics modes. Two examples are VGA cards with the Trident chipset and the Tseng Labs chipset. The Trident chipset will allow 640x400 and 640x480 pixel images to be displayed. The Tseng Labs chipset will allow 640x480 and 800x600 pixels to be displayed (all these modes with 64 grey levels per pixel). In addition a VESA standard VGA card can also be used. This software will allow any of the five modes mentioned above to be used, depending on the VGA card and monitor (not all monitors will work with these modes). The main program: vga512.exe comes with a configuration file config.vga that is read by the program on loading. An example of the file is: vga512.hlp 256 256 c:\images\ normal200 dynamic mouse Line 1: This states the help file the software uses - do not alter. Line 2: This states the maximum size of image to process. The only other possible size is 512 512 Line 3: This is the default image directory. By stating the image to read as say "geoff", the software looks for an image "c:\images\geoff.img" Line 4: This states the VGA mode to use for display etc. Possible names are: normal200 320x200x6 bits per pixel (IBM standard) trident400 640x400x6 bits - Trident chipset trident480 640x480x6 bits - Trident chipset tseng480 640x480x6 bits - Tseng labs chipset tseng600 800x600x6 bits - Tseng labs chipset vesa600 800x600x6 bits - VESA standard chipset Line 5: This states the type of memory to use for images. If an EMS handler is present on the machine use ems else use dynamic Line 6: This states the type of pointing device present. Possible names are mouse when a microsoft mouse is installed and desired, or keys when no mouse driver is present or it is desired to use the cursor keys The software works on a command line basis. Each image processing operation is a three letter mnemonic that is an acronym or abbreviation of the full command. Along with the mnemonic is a number of parameters on the command line. The first 1,2 or 3 are invariable numbers that refer to the image(s) to be processed and the rest are necessary parameters, filenames etc. An example is: rea 1 girl which reads an image called c:\images\girl.img into image number 1. Another example is: cmp 1 2 which complements image 1 into image 2 i.e. inverts it so it looks like a negative image. Text and images are difficult to display at the same time because a text generator for the graphics modes is not available yet. The default is to have text on the screen and when an image is to be displayed to type wis image_no which will display image 1 on the screen. Return to text mode is by hitting any key. Some commands use the mouse such as "cur" and "win". If a mouse is not present the numeric keypad can be used. Keys 1 to 9 move a cross around the screen. The + doubles and the - halves the step. Below is essentially the help file vga512.hlp which contains most of the commands. Some are missing because the software is in a state of flux with new commands added without the documentation. The commands ctm and ifs are for when a framestore is attached for grabbing images. These can be ignored. Some help is available while running the program. If you type the command with no arguments, the possible options are listed. This assumes you know what the command does! Use "hlp" to view the help documentation. COMMAND SUMMARY Arithmetic ADD - P1 + P2 -> P3 SUB - P1 - P2 -> P3 MIN - Min(P1, P2) -> P3 MAX - Max(P1, P2) -> P3 MUL - P1 * P2 -> P3 DIV - P1 / P2 -> P3 EXP - Exponential(P1) -> P2 LOG - Ln(P1) -> P2 SET - Set(P1) to P2 Logical AND - And(P1, P2) -> P3 ORR - Or(P1, P2) -> P3 XOR - Xor(P1, P2) -> P3 CMP - Cmp(P1) -> P2 SHL - Shl(P1) BY P3 -> P2 SHR - Shr(P1) BY P3 -> P2 Filter LPF - low pass filter (3x3 average) P1 -> P2 HPF - high pass filter (3x3 laplacian) P1 -> P2 SED - Sobel edge detector P1 -> P2 GRA - gradient operator (2D) P1 -> P2 HGR - horizontal gradient detector P1 -> P2 VGR - vertical gradient detector P1 -> P2 Binary THR - Threshold(P1) -> P2 SKW - Shrink(P1) -> P2 EXW - Expand(P1) -> P2 THN - Thin(P1) -> P2 NUM - Numerate objects/blobs(P1) -> P2 Boundary MES - locate and measure number of acceptable objects in image P1 Hough Transform CIR - Hough Transform approach to Circle Detection LIN - Hough Transform approach to Line Detection Histogram HTI - tabulate histogram for image P1 on terminal HPI - plot histogram graphically HEQ - histogram equalisation for image P1 -> P2 CST - contrast stretch image P1 -> P2 Input/Output CTM - display live video from TV camera IFS - grab frame(s) from TV camera WIS - display image (window) P1 on VGA monitor WIQ - display image (window) P1 on VGA monitor in quadrants DIS - display image (all) P1 on VGA monitor - not useful OFP - output binary image in P1 to Epson printer WRC - save binary image in P1 in run-coded format to disk RRC - restore binary image to P1 from run-coded format on disk REA - read image into P1 from disk WRI - write image P1 to disk Macro commands MAC - command macro facility HLD - pause in macro execution for user prompt REP - repeat macro from beginning Miscellaneous ASP - aspect ration correction BOR - set one pixel wide border to a value CUR - display cursor on image P1 CAL - use cursor for calibration WIN - use cursor to determine image extent (x,y) -> max (x,y) RES - state extent of image min (x,y) -> max (x,y) RFS - show status of system - image size etc. ZOM - zoom (magnify) portion of image P1 -> P2 by factor N PLT - plot intensity cross-section through image P1 HLP - display help information END - exit from image processing system THC - real time threshold determination WRP - image warping DEF - redefine the image directory CPY - copy P1 -> P2 RGR - region growing