Itseez/opencv — pull request #226 by taka-no-me (2012-12-15 11:36:57+00:00)
Title: Fix equalization formula in equalizeHist function & rewrite in C++

Old implementation did

lut[i] = 255 * (count(Y <= i)) / (width * height)

which actually shifts uniform histograms.
From now histogram is equalized as

C = count(Y == min(Y))
lut[i] = 255 * (count(Y <= i) - C) / (width * height - C)