# Mathematically show the problem of Histogram Equalization

This works well when the distribution of pixel values is similar throughout the image. However, when the image contains regions that are significantly lighter or darker than most of the image, the contrast in those regions will not be sufficiently enhanced.

How can I prove or at least describe this concept mathematically?

• Jan 2, 2023 at 12:58

I will sketch what you can do:

1. Create an image which has limited Dynamic Range (DR). Something like all values are 100-125.
2. On 25% of the left part of the image generate values in the range 126-150.

In order to enhance the contrast you'd optimally work on each side on its own. To stretch its DR on the whole available range.

So if we stretched each section on its own, we would move from a range of ~25 levels to ~255 levels, an order of magnitude.

Yet when we work on the whole image, we probably stretch each side by a factor of ~5.

Hence, for zones with local properties of DR it is better to use local equalization.

• Excuse me, what is the meaning of "DR"? Jan 11, 2023 at 10:15
• @hasanghaforian, DR - Dynamic Range. I edited the answer to make that explicit.
– Royi
Jan 11, 2023 at 12:02