Histogram Equalization: Neighborhood Adaptive

From MIPAV
Revision as of 20:16, 20 July 2012 by Olga Vovk (Talk | contribs)

(diff) <previousrevision> | Latest revision (diff) | <nextrevision> (diff)
Jump to: navigation, search

The Histogram Equalization: Neighborhood Adaptive algorithm, a high-pass filter, enhances the contrast in an image by reevaluating the grayscale, or intensity, value of each pixel based on a region of nearby pixels.

Background

Features in some images require a larger range of intensity values than are displayed. Histogram equalization is a method to improve the contrast of an area in an image by shifting intensity values so that there are an equal number of pixels in an image in each intensity. This algorithm tabulates the histogram for a collection of neighboring pixels, sometimes called a kernel and then assigns the pixel to the new histogram level.

The name of this algorithm signifies that it processes the image by looking at the neighboring pixels when performing the equalization; hence, the name Neighborhood, or Local, Adaptive Histogram Equalization. Each neighborhood of pixels is the source when remapping the histogram, adapting the value of the pixel to its location in the histogram of the neighborhood.

The algorithm first collects a list of the pixel's neighbors, calculates the bin width of the pixel neighborhood, then builds the histogram of the neighborhood.


DefinitionIcon.jpg

bin width-The permitted range of floating-point values of a pixel to equate to an intensity level in a 256-color image.


The algorithm locates the value of the central pixel in the local histogram and replaces its intensity with the corresponding value in the histogram of its neighbors. The algorithm remaps the brightest pixel in a pixel neighborhood to the brightest value in the histogram (i.e., 256) and the darkest pixel to the lowest value of the histogram (i.e., 0), recording the new values as pixel-intensity values. It then processes each pixel in this way, remapping pixel value to intensity as measured against a histogram of the pixel's neighbors until the algorithm finishes checking all pixels of the image against the histogram of its neighbors and builds a new, or reference, image.
Performing histogram equalization makes it possible to see minor variations within portions of the reference image that appeared nearly uniform in the original, or source, image.

Arithmetically, the process in a neighborhood is rather simple:
HistogramEqualizationNeighborhoodAdaptive13.jpg

where Ni is the intensity of the i'th pixel, and T is the total number of pixels in the neighborhood.

Neighborhood size greatly affects the reference image, since the intensity of each resulting pixel depends on the neighborhood. The more pixels in the neighborhood that are darker than the current pixel, the greater in intensity the current pixel becomes in the reference image. Likewise, the shape of the kernel determines the number of pixels in the neighborhood.

The algorithm creates a kernel around a pixel in a region of the image as shown in Figure 1. It then ranks the intensity of that pixel as compared to the surrounding pixels. In the figure, the box is 65 pixels wide. Using a square kernel, the algorithm collects all the pixel intensities inside the square and at the edges of the square. (Using a cross kernel, however, it collects only the intensities under the orange cross-hairs.) It next ranks the pixel intensity at the center of the cross hairs against the histogram of the pixels in the kernel.

Figure 1. Sample of kernel created by algorithm

ExampleHistogramNeighborhoodSampleKernel.jpg

The reference image using the new histogram is similar to the source image; however, in areas where the original image had similar values, the reference image is enhanced. The output histogram now stretches over a greater proportion of the possible image intensities.

Figure 2 shows example images that were created by starting with a source image then using a 21 x 21, a 45 x 45, or 65 x 65 square kernel through the image.

The histogram of the source image is very compact in structure; that is, it has a great number of darker pixels, but very few brighter pixels. In fact, the bottom-most intensity values make up almost all of the pixels' values in the image. Note, however, in the histogram of the reference image, the look-up table is more evenly spread than in the histogram of the source image. Also, areas of low intensity and low contrast in the source image were correspondingly remapped in the reference image to areas of higher contrast and generally overall brighter values.

Noteicon.gif

Note: The red line at the border of the image is an active image line, a part of the program to help the user determine which image is on top and not a part of the image itself.


Figure 2. A source image and its histogram (A, B) compared to reference images using a 21 x 21 (C, D), 45 x 45 (E,F), or 65 x 65 (G,H) square kernels and 65 x 65 (I,J) cross kernels




ExampleNeighborhoodHistOriginal.jpg

ExampleNeighborhoodHist21square.jpg
ExampleNeighborhoodHist45square.jpg


ExampleNeighborhoodHist65square.jpg



ExampleNeighborhoodHist65cross.jpg

There are a couple of features to notice about the resultant images. First, the reference images contain a lot of noise. This noise results because the algorithm remapped the areas of the image with smooth features using a histogram used for features with great variation (such as the lung cavity in the example images). Second, notice that the algorithm remaps large areas of the same level of intensity values very high-intensity areas. This feature could be expected, is distracting when viewing the image, and is therefore a good reason to include a threshholding feature to prevent processing on a pixel when its intensity is too low.

The histogram equalization process can enforce certain characteristics about the image called clipping. As the algorithm processes the image, it counts out the number of pixels of a certain intensity. Clipping cuts that counting short; it stores the excess pixels of a particular intensity and redistributes that number equally among all intensities. For instance, if a particular intensity must be clipped at 100 and the count is 145, the algorithm redistributes 45 pixels to other brightnesses. It adds to the count of each intensity level an equal number of pixels if there are enough excess, but attempts to spread the excess over as many pixels as possible.

Figure 3. The effect of thresholding on images


ExampleNeighborhoodHistLUT65squareNoThreshold.jpg




ExampleNeighborhoodHistLUT65squareThreshold-800.jpg





Figure 4. A reference image and histogram with no clipping and with 75-percent clipping

ExampleNeighborhoodHistLUT65SquareNoClipping.jpg


ExampleNeighborhoodHistLut65Square75Clipping.jpg
Figure 5. A reference image and histogram with 45-percent clipping



ExampleNeighborhood65square45Clipping.jpg

Image types

You can apply this algorithm to both color and black-and-white images.

Special notes

This algorithm can evaluate the entire image or only specified volumes of interest (VOIs).

References

Refer to the following references for more information:

Bob Cromwell, "Localized Contrast Enhancement: Histogram Equalization," paper on his web site at http://www.cromwell-intl.com/3d/histogram/Index.html.

Douglas A. Lyon, Image Processing in Java (Upper Saddle River, New Jersey: Prentice-Hall, 1999).

Tamer Rabie, Rangaraj Rangayan, Raman Paranjape, "Adaptive-Neighborhood Image Deblurring," The University of Calgary, Department of Electrical and Computer Engineering (Calgary, Alberta, Canada: NEC Research Institute, 2002).

John Russ, The Image Processing Handbook (Boca Raton, Florida: CRC Press LLC, 2003).

J. Alex Stark, "Adaptive Image Contrast Enhancement Using Generalizations of Histogram Equalization," in IEEE Transactions on Image Processing (May 2000).

Claes Tidestav, "Short Introduction to Adaptive Equalization." (Uppsala, Swedon: Uppsala University, April 1996).

Applying the Histogram Equalization: Neighborhood Adaptive algorithm

To run this algorithm, complete the following steps:

  1. Open an image.
  2. Perform, as an option, any other image processing on the image.
  3. Select Algorithms > Histogram Equalization > Neighborhood Adaptive. The Local Adaptive Histogram Equalization dialog box ([HistogramEqualizationNeighborhoodAdaptive.html#wp1102998 Figure 20]) opens.
  4. Complete the information in the dialog box.
  5. Click OK. The algorithm begins to run.
A pop-up window appears with the status. A series of status messages appear in the window.
When the algorithm finishes running, the pop-up window closes.
Depending on whether you selected New image or Replace image, the results appear in a new window or replace the image to which the algorithms was applied.
Figure 6. Local Adaptive Histogram Equalization dialog boxÂ

Kernel size
Indicates the number of pixels horizontally or vertically to be used in finding the histogram with the pixel in question at the center. Select 31, 45, 65, or 129, or type an odd number.
DialogboxLocalAdaptiveHistogramEqualization.jpg

Kernel shape
Specifies the shape of the kernel the algorithm should use. Select either:
  • Square-To evaluate all pixels on any column or row away from the central pixel to the perimeters of the kernel
  • Cross-To choose from only pixels in the same column or row to the perimeter of the kernel as neighbors of the pixel.
Use as scale maximum
Specifies where to find the maximum for the resulting histogram. Select Local, Slice (default), or Image. Note: This value is predefined for some image formats.
Use threshold
Limits the algorithm to evaluate pixels only when above the specified value. By default, this field is clear and the algorithm therefore evaluates all pixels.
Any given input, however, prevents some pixels from being evaluated. Although using this option potentially causes some valuable pixels to be lost, it reduces the noise associated with evaluating the image edges, which is usually only an image of the imaging device. The default is image minimum value.
Use clamping
Indicates the percentage (1 through 99) of the maximum number of pixels per intensity allowed. The algorithm first calculates the number of pixels per intensity and then applies the clamping percentage to yield a maximum number of pixels per intensity allowed. The algorithm records the excess pixels for any intensity that has more pixels than the calculated value and redistributes them equally among all intensities. By default, this field is clear; when selected, 75 is the default percentage.
Red channel
Treats all of the pixels in the red channel as its own intensity as if the image were three separate monochrome images (only applicable to color images). You can opt to act on any combination of red, blue, or green color channels.
Green channel
Treats all of the pixels in the green channel as its own intensity as if the image were three separate monochrome images (only applicable to color images). You can opt to act on any combination of red, blue, or green color channels.
Blue channel
Treats all of the pixels in the blue channel as its own intensity as if the image were three separate monochrome images (only applicable to color images). You can opt to act on any combination of red, blue, or green color channels.
New image
Shows the results of the algorithm in a new image window.
Replace image
Replaces the source image with the results of the algorithm.
Whole image
Applies the algorithm on the entire image.
VOI regions
Applies the algorithm to only the selected VOI.
OK
Applies the algorithm according to the specifications in this dialog box.
Cancel
Disregards any changes you made in this dialog box and closes the dialog box.
Help
Displays online help for this dialog box.