Reputation: 575
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?
Upvotes: 0
Views: 554
Reputation:
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.
Upvotes: 2