Previous Table of Contents Next


Histograms

An image histogram is a two-dimensional, graphical bar-chart representation of the three-dimensional achromatic image. As you might suspect, something is lost along the way, namely pixel position information.

Histograms present a simplistic accounting that indicates how many pixels assume various pixel values. If an image is an 8-bit image, then there are 256 possible values—zero through 28–1, or 255. The horizontal axis usually specifies the valid pixel values and the vertical axis usually indicates how many pixels assume the values. Because thousands of pixels may assume any allowed value in large, high-resolution images and the actual pixel value distribution is less important than the relative distribution, the vertical axis scale is usually compressed to give a bird’s eye view of the distribution that fits on a screen or page.

The VIDEO.C program depends on standard VGA resolution that only supports 64 colors which are set as 64 monochromatic intensities. Thus, VIDEO.C generates histograms for its 6-bit achromatic images by first determining how many pixels assume each of the 26–1 (64) values and coincidentally sets the maximum vertical height for each graphical value to 64. It then determines how many pixels assume each of the possible 64 pixel values. The program calculates its scaling factor by identifying the pixel value that has the most occurrences within the image and dividing this pixel value’s occurrence count into the maximum allowable height which is arbitrarily selected as 64. The program then multiplies the occurrence count for each possible pixel value by this calculated scaling factor to determine the graphical output bar height for each possible pixel value.

The use of histograms is limited because their representations forfeit information regarding pixel locations. For example, images of black and white checkerboards would have the same histogram as images consisting of black lines on white backgrounds. The lines could be vertical, horizontal, slanted, thick, or thin. Yet the images are all decidedly different.

Histograms are useful because they show when an image contains poor dynamic range that looks foggy because it exhibits low contrast that provides little visual detail. Remembering that dynamic range is the difference between the highest pixel value and the lowest pixel value, histograms for images having poor dynamic range consist of a few close-proximity vertical bars. Images with improved contrast better exploit the available pixel value range which monitor slew rates and printer mechanics, ink, or paper may constrain from the maximum numerically allowable.

In all cases, one input point generates one output point, but the output image remains faithful to the input image though its appearance is enhanced to some end or subjective purpose. Image enhancement techniques therefore attempt to convert images exhibiting poor dynamic range into images exhibiting expanded dynamic range by “spreading out” pixel values using various techniques which fall under the category of point operations.

Point Operations

Point operations are operations that determine an image pixel output value using some strategy that only examines the corresponding input pixel value, regardless of position or surrounding values. This simplistic approach often allows algorithms to calculate look-up tables in advance, accelerating output generation. Graphically representing the look-up table reveals the specific strategy, or mapping function, which should not be confused with an image histogram.


Figure 12-1  Identity mapping function


Figure 12-2  Threshold strategy


Figure 12-3  Complement mapping function

For example, suppose we trivially wish to generate a 6-bit output image that is identical to a 6-bit input image. Here, a pixel position output value would be identical to the pixel position input value. Figure 12-1 presents the mapping function’s graph which is the identity mapping function. Figure 12-2 depicts a threshold strategy where every value below 32 is set to zero and every value above 31 is set to 63. Figure 12-3 presents a complement mapping function which generates a negative image. Here the mapping formula is:

(output pixel value) = (maximum allowable pixel value) – (input pixel value)

Finally, remembering the preceding gamma correction discussion, gamma correction is also a point process that depends only on an input value to generate an output value using a selected gamma value.

Histogram Slide

Sometimes it is possible to improve an image by adding a constant value to each pixel value. When the sum is a value that is greater than the maximum allowable value, the output pixel value is set (or clamped) to the maximum allowable value.

(temporary value) = (input pixel value) + (constant value)

(output pixel value) = minimum of (maximum allowed value, temporary value)

Similarly, it is sometimes possible to improve an image by subtracting a constant value from each pixel value. When the difference is a value that is less than the minimum allowable value, the output pixel value is clamped to the minimum allowable value.

(temporary value) = (input pixel value) – (constant value)

(output pixel value) = maximum of (minimum allowed value, temporary value)

Because these mapping functions alter input values by a constant, the output image histogram is essentially the input image histogram moved to the right or left depending on whether the mapping function is subtracting or adding the constant respectively—hence the name histogram slide. This is similar to adjusting a monitor’s brightness control setting to a higher or lower value respectively. Figure 12-4 illustrates the mapping function that adds a constant value of 4 to each pixel value. This shifts the input image histogram to the right.


Figure 12-4  Mapping function that adds a constant value of 4 to each pixel value

Histogram slides are sometimes useful to move pixel value ranges into the region where the eye is most sensitive to discerning detail. They are also useful to position a histogram for a subsequent histogram stretch.


Previous Table of Contents Next