0

I found the histogram of an RGB image using concrete values in the range [0x000000; 0xffffff], rather than in the range [0,255] for the three separate channels or using bins for one channel (because I need to have a big range). And now I need some image processing algorithms that uses the type of histogram I built.

To be more precise, I computed 2 histograms in two ways, and there is some difference between numbers. Now I need to see the difference in the results of algorithms by giving them these two datasets.

I found "histogram equalization" algorithm, however, as I understand, it's not applicable in my case. So, is there any such algorithms?

Bobur
  • 545
  • 1
  • 6
  • 21
  • You'd better convert image into HSV first and make three different histograms. There's no practical use for histogram like your. – Eddy_Em Jun 01 '16 at 05:30
  • @Eddy_Em thanks for comm. I attempted by converting the image to YCrCb. But for my case, I need to have more bins than 255. – Bobur Jun 01 '16 at 05:39
  • @Eddy_Em, if, **indeed**, there is no practical use of this type of histogram, then, for me, it is enough to know that. Thank you – Bobur Jun 01 '16 at 05:42
  • Any decent color quantization algorithm benefits from 3D histograms see [Effective gif/image color quantization?](http://stackoverflow.com/a/30265253/2521214). In some cases 2D HSV histogram is used instead see [drawing HSV histogram](http://stackoverflow.com/a/29286584/2521214) – Spektre Jun 01 '16 at 07:32

1 Answers1

2

A full 24 bits RGB histogram has 2^24 = 16777216 bins and will occupy 67MB of storage (!). Unless the image is huge, most of the bins will be zero.

Processing the histogram is much more costly than processing the image itself. Just clearing the histogram is time consuming. So such a data structure is virtually of no use.

What's more, in real-world images, the color components are usually highly correlated, so that three 1D histograms are nearly as informative.

If you really want a 3D histogram, then it is highly advisable to sacrifice a few bits of accuracy by truncating the values, say to 6 or 5 bits per component, resulting in a total of 262144 or 32768 bins.

Lastly, notice that histogram equalization isn't well defined for color images as it needs scalar input data, so in practice you equalize on a single component (lightness).


Update:

The color clustering algorithms (among which the so-called color quantization algorithms used for rendering/compression, https://en.wikipedia.org/wiki/Color_quantization) are indeed conceptually operating on the RGB histogram. Anyway, implementations usually do not rely on an explicitly computed histogram but on the individual RGB pixel values.