| Previous | Table of Contents | Next |
This chapter provides brief descriptions of programs contained on the CD-ROM accompanying this book. Please read the licensing information each program contains.
The VIDEO.C program demonstrates monochromatic image manipulation techniques using a 96x96, 6-bit-per-pixel monochromatic image. The source image is slightly out of focus and chosen to illustrate sharpening techniques. It was scanned at a horizontal resolution 1.2 times greater than vertical resolution to compensate for a 320x200 graphics screen resolution aspect ratio (a 320x240 screen resolution has a 1:1 aspect ratio and 240 divided by 200 equals 1.2). This original image is included in the program using the image.h file the ARRAY96.C program produces. Users can alternately create their own 96x96 binary image and specify its name as a run-time argument. This allows VIDEO.C to load the specified image for subsequent manipulation operations that include gamma correction, sharpening, histogram stretching, histogram equalization, and a variety of digital halftone algorithms.
VIDEO.C begins operation by first checking whether a run-time argument is specified. If so, the LoadOriginalImage() function loads the specified image into the Image[96][96] array defined in image.h and zeros the high-order two bits of each pixel value to ensure each pixel consists of six significant bits. After presenting the program logo and waiting five seconds, VIDEO.C sets the screen resolution to 320x200 the lowest common denominator VGA screen resolutionby invoking SetVideo320x200().
The 320x200 screen resolution provides a standard 256-color VGA palette. However, VIDEO.C only uses 64 palette entries with each entry providing a different monochromatic screen intensity. While the screen resolution is less than possible on many screens, the program operates on standard VGA systems as well as SVGA systems. Even with 6-bit DACs, a standard VGA palette provides more monochromatic intensity values than 15-bit and 16-bit direct color modes which each can only support 32 monochromatic intensities. Only 24-bit direct modes combined with 8-bit DACs provide more (256) monochromatic intensities.
After setting the screen mode, VIDEO.C invokes GenerateGammaCorrectedGrayScalePalette() which constructs a gamma corrected palette in the PaletteArray[PALETTE_SIZE_64][3] global array by designating equal RGB intensity values. The GAMMA_CORRECTION_VALUE preprocessor identifier determines the gamma correction value, and the intensity normalization factor is 63 since intensities vary from zero to 63. Invoking the normal int 10h BIOS video interrupt loads the palette into the video controller.
VIDEO.C next presents the source image by invoking ZoomIn() which uses a progressive resolution technique. ZoomIn() samples the source image by dividing it into 16x16 square areas and using the upper left pixel to represent the entire 16x16 output image area. After a half-second delay, it repeats the process using progressively smaller 8x8 square areas, then 4x4 square areas, and finally 2x2 square areas.
Eventually, DisplayOriginalImage() executes and presents the entire source image. This routine invokes DisplayScreenHistogram() which calculates a histogram for any 96x96 screen area with the specified upper left corner and displays the histogram at the specified position (below the source image). The continuously varying intensity bar beneath the horizontal provides a visual guide to the pixel intensities immediately above.
When DisplayNegativeImage() executes, it presents the source image negative starting at row position zero, column position 100. This routine invokes DisplayScreenHistogram() to calculate the negative image histogram and display it below the negative image.
VIDEO.C next presents the source image bit planes individually starting with the high-order bit position and moving progressively to the low-order bit position by invoking DisplayBitPlanes(). At every pixel position, if a tested bit has a one value, the operations produce a white dot in that pixel position. Otherwise, the output pixel is black. The first pass pre- sents a threshold operation and subsequent operations present increasing bit-plane refinements. Note the banded appearance of some intermediate bit positions and the final random appearance of the final operation.
VIDEO.C next invokes DisplayContourImages() which presents a sequence of images that illustrate image contouring. Beginning with a threshold operation that presents only high-order bit information, the successive images add the next significant bit value to produce increasing detail. So, the first image presents only bit five information; the next bits five and four; the next bits five, four, and three, etc. The successive images are cumulative refinements, and the posterization effect that occurs when only a few bit levels are used to represent an image is evident.
| Previous | Table of Contents | Next |