9887

Histogram Equalization

The histogram of an image shows how many pixels have each of the possible intensity values. Histogram equalization is a kind of contrast enhancement that stretches the histogram so that all values occur (more or less) an equal number of times. The resulting image uses the full range of possible values. This often works well, especially for bringing out details in overly light or overly dark sections of a grayscale image. When operating on color images, straightforward application of the histogram equalization to the red, green, and blue channels increases the contrast, but may also change the color balance. A common trick (selected here using the mode chooser box) is to operate in the HSB colorspace, applying the histogram equalization to the brightness channel, while leaving the hue and saturation channels unchanged. The display shows the original image on the left and the equalized image on the right. The histograms of the two images are shown immediately below. Observe how the RGB mode stretches all three channels while the HSB mode only stretches the brightness channel.

SNAPSHOTS

  • [Snapshot]
  • [Snapshot]
  • [Snapshot]

DETAILS

Histogram equalization is a classic image processing technique that adjusts the contrast of an image so that the image utilizes the full range of possible values from 0 (black) to 255 (white). In the equalized image, each value occurs with (roughly) the same frequency. The method is described in many places, including the Wikipedia article and the book cited below. This implementation can operate on grayscale images (where it is probably most effective) and on color images, where two choices are possible: equalization of the three RGB channels separately or equalization in the HSB colorspace, where the equalization is applied only to the brightness channel. This implementation also allows the addition of dither (using the slider), which can help to fill in empty spaces in the histogram. An example is the tank image; without dither, the equalized histogram is spikey and does not use all the possible grayscale values. Adding dither smooths this out, though too much dither is tantamount to adding noise to the image. A good rule of thumb is to add dither until you can start to actually see the graininess in the image, then reduce the dither somewhat.
References
[1] Wikipedia. "Histogram Equalization." (June 28, 2012) en.wikipedia.org/wiki/Histogram_equalization.
[2] R. C. Gonzalez and R. E. Woods, Digital Image Processing, 3rd ed., Upper Saddle River, NJ: Prentice Hall, 2007.
    • Share:

Embed Interactive Demonstration New!

Just copy and paste this snippet of JavaScript code into your website or blog to put the live Demonstration on your site. More details »

Files require Wolfram CDF Player or Mathematica.









 
RELATED RESOURCES
Mathematica »
The #1 tool for creating Demonstrations
and anything technical.
Wolfram|Alpha »
Explore anything with the first
computational knowledge engine.
MathWorld »
The web's most extensive
mathematics resource.
Course Assistant Apps »
An app for every course—
right in the palm of your hand.
Wolfram Blog »
Read our views on math,
science, and technology.
Computable Document Format »
The format that makes Demonstrations
(and any information) easy to share and
interact with.
STEM Initiative »
Programs & resources for
educators, schools & students.
Computerbasedmath.org »
Join the initiative for modernizing
math education.
Step-by-step Solutions »
Walk through homework problems one step at a time, with hints to help along the way.
Wolfram Problem Generator »
Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.
Wolfram Language »
Knowledge-based programming for everyone.
Powered by Wolfram Mathematica © 2014 Wolfram Demonstrations Project & Contributors  |  Terms of Use  |  Privacy Policy  |  RSS Give us your feedback
Note: To run this Demonstration you need Mathematica 7+ or the free Mathematica Player 7EX
Download or upgrade to Mathematica Player 7EX
I already have Mathematica Player or Mathematica 7+