Histogram Equalization and Local Contrast
Two photographs can have the same darkest and brightest pixels yet show very different contrast.
Histogram Equalization and Local Contrast explained visually
Two photographs can have the same darkest and brightest pixels yet show very different contrast. English captions are optional and start off. The complete transcript follows the written lesson.
What you will learn
Two photographs can have the same darkest and brightest pixels yet show very different contrast.
Redistribute intensities
The scratch is still faint in the darker area of our metal-part image. The picture uses a narrow band of gray values even though the file could hold a much wider range. Could spreading that band help us see the mark? Histogram equalization uses the accumulated counts of intensity values to make a new mapping. It changes the existing measurements for viewing; it doesn't recover a scratch that was never recorded.
Global and local methods
With global equalization, one mapping applies to the whole image. That may reveal a dim feature, but it can also make a normally exposed area harsh or amplify background noise. A local method works in smaller neighborhoods. Contrast-limited adaptive histogram equalization, pronounced 'clay,' restrains strong local amplification and blends neighboring areas. Its window size and limit still need testing.
Judge the task, not the drama
Put the original, a global result, and a local result side by side. Inspect the scratch and a quiet patch of metal. If both get equally more textured, you may be making noise easier to see. On a color image, don't independently equalize red, green, and blue without checking for color shifts; a brightness-related channel can be a better starting place.
A worked example
Keep the original and record the chosen mapping. Next, we'll use neighboring pixels directly to build filters rather than just remap intensity values.
Worked example
Consider a wall whose useful grayscale values occupy only 90 through 120. Expanding that narrow range can make markings easier to see. But if nearby pixels differ because of sensor noise rather than real markings, the same expansion also makes that noise more visible.
Quick check: test your understanding
Try it yourself: Compare global equalization and a mild local contrast setting on one shadowed image. Inspect a flat background and a detailed region separately.
Check the reasoning
Record whether real edges become clearer, whether background noise grows, and whether colors shift. Choose settings based on those observations, not only the overall appearance.
Does equalization know which intensity changes belong to real objects?
No. It remaps distributions and can amplify unwanted variations too.
How would you solve the practice case?
Record whether real edges become clearer, whether background noise grows, and whether colors shift. Choose settings based on those observations, not only the overall appearance.
What does the worked example show?
Consider a wall whose useful grayscale values occupy only 90 through 120. Expanding that narrow range can make markings easier to see. But if nearby pixels differ because of sensor noise rather than real markings, the same expansion also makes that noise more visible.
Further reading
Digital Image Processing, 4th edition — Rafael C. Gonzalez and Richard E. Woods.
Original ToolsInVision teaching examples. Editorial approach · Suggest a correction
Accessible referenceLesson 6 transcript214 words · Video transcript · Matches the published narration and captionsOpen transcript
The scratch is still faint in the darker area of our metal-part image. The picture uses a narrow band of gray values even though the file could hold a much wider range. Could spreading that band help us see the mark? Histogram equalization uses the accumulated counts of intensity values to make a new mapping. It changes the existing measurements for viewing; it doesn't recover a scratch that was never recorded.
With global equalization, one mapping applies to the whole image. That may reveal a dim feature, but it can also make a normally exposed area harsh or amplify background noise. A local method works in smaller neighborhoods. Contrast-limited adaptive histogram equalization, pronounced 'clay,' restrains strong local amplification and blends neighboring areas. Its window size and limit still need testing.
Put the original, a global result, and a local result side by side. Inspect the scratch and a quiet patch of metal. If both get equally more textured, you may be making noise easier to see. On a color image, don't independently equalize red, green, and blue without checking for color shifts; a brightness-related channel can be a better starting place.
Keep the original and record the chosen mapping. Next, we'll use neighboring pixels directly to build filters rather than just remap intensity values.