# 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
• @hasanghaforian, Could you please review my question? If it answers your question, please mark it.
– Royi
Apr 9, 2023 at 9:33
• Thank you for your time and excuse me for long delay. What was doubted me was the exemplary nature of your answer, while I was looking for a mathematical proof for it. Can we see images as a random process of signals and thereby find proof? May 27, 2023 at 4:01
• @hasanghaforian, You can prove it mathematically, indeed as when the pixels are realizations of a random variable. You can show the ratio between 2 bins in 2 cases.
– Royi
May 27, 2023 at 6:51