Tell me more ×
Cross Validated is a question and answer site for statisticians, data analysts, data miners and data visualization experts. It's 100% free, no registration required.

I am learning some image processing stuff and equalizing a histogram comes up as an important topic. I have followed the procedure listed on Wikipedia but the resulting equalized histogram does not look much better to me.

Let's say I have the following histogram where values only range from 0 to 7:

0 | 2
1 | 6
2 | 12
3 | 13
4 | 6
5 | 11
6 | 7
7 | 7

The equation to equalize the histogram is as follows: $h(v) = round(\frac{cdf(v) - cdf_{min}}{(M*N) - cdf_{min}} * (L - 1))$

So, using this I get the following:

$h(0) = 0$

$h(1) = 1$

$h(2) = 2$

$h(3) = 4$

$h(4) = 4$

$h(5) = 5$

$h(6) = 6$

$h(7) = 7$

Transferring this over to the new histogram, I get the following equalized histogram:

0 | 2
1 | 6
2 | 12
3 | 0
4 | (13 + 6) = 19
5 | 11
6 | 7
7 | 7

This doesn't look right at all... Have I done something incorrectly?

share|improve this question

1 Answer

up vote 1 down vote accepted

You have correctly applied the formula.

It does not help your example mainly because the values are already spread out. In fact you lose a little information.

But histogram equalization is designed to deal with other types of cases where the data is mainly clumped together in a small part of the distribution, and where you want to increase the contrast across the distribution.

If you had started with

0 | 7
1 | 10
2 | 13
3 | 22
4 | 1
5 | 2
6 | 7
7 | 2

you would have ended with something like

0 | 7
1 | 10
2 | 0
3 | 13
4 | 0
5 | 0
6 | 25
7 | 9

which would have increased the visible contrast (though still losing a little information in the data).

share|improve this answer
Interesting! It really seemed like I was doing it correctly, but the results actually look more clumped together in the result, so I was confused. Thanks for verifying – Coffee Dec 17 '11 at 3:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.