Saturday 30 November 2019

How do I interpret individual colors on RGB histogram?



I know how to read the Luminosity histogram and I thought that I knew how to read RGB histogram as well, until I saw the following example:


enter image description here


The RGB histogram shows exactly the same 3 'spikes'. What are these? I can tell that they all come from the same 'sky' source, but why aren't they on the same horizontal place?



Answer



Simple: the color of the sky is comprised of the mix of all three channels. If it were gray, there would be equal amounts of red, green, and blue. It's not, though — there's a lot more blue, a little less green, and very little red. Pretty much like this:


rgb


Check out how the arrows on the slider are pretty much exactly at the same percentages as the spikes in your histogram.


If you put the sliders all in the same place...


gray


...the histogram lines would coincide, but your color would change...



compare


...to dark gray instead of the kind of teal it was in your sample image.




Here's a representation of the digital form of this file. Each pixel is a triad of (red,green,blue), so a teal pixel is represented as( 28,123,142). Because there's only so much room to type, I'm making this very low resolution but you should get the idea. Here, the values go from 0 to 255.


( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)
( 28,123,142) ( 28,123,142) ( 28,123,142) ( 28,123,142) ( 28,123,142)
( 28,123,142) ( 28,123,142) (201,201,201) ( 28,123,142) ( 28,123,142)
( 28,123,142) ( 28,123,142) ( 28,123,142) ( 28,123,142) ( 28,123,142)
( 28,123,142) ( 28,123,142) ( 28,123,142) ( 28,123,142) ( 28,123,142)


This ends up looking like this tiny little thing: sample


I don't have the same software you do, but load it in to your program and look at the histogram. The histogram just shows a graphical representation of the counts of each channel at each level. You should see a little bump over to the middle right representing the gray dot, and then spikes at 28 for red, 123 for green, and 142 for blue. Here's what it looks like in the software I have:


histogram of sample


The image doesn't look very red, and it's not. But what red there is is clustered all in that one color, and that's a huge percentage of the image, so you get a spike.


This is a rather technical tool, and while it can be very useful, it doesn't show a nice perceptual map of the colors in the image. That would be a different visualization.


Something that might be more like what you want is called a "3D Color Histogram". The Color Inspector Plugin for ImageJ does this, as does the windows-only program Colorspace, or you can use this web site: http://3dhistogram.com — which I just discovered and which looks pretty nifty (and no-hassle) but is maybe more cool than useful.




In the discussion in the comments below this answer, ClarityForce points out Tyler Neylon's nice open-source implementation of Hue Histograms. There's a "traditional" histogram, a pie chart, and a combined version. The combined version looks great with many real images, but is not so impressive with the sample of the moon image cropped from the one posted in the question. Here's the hue histogram and pie chart from that, though:


moon sample hue histogrammoon sample hue pie chart


And, just for fun, here's the three types of hue charts it can make for the Mona Lisa:



mona hue histogram


No comments:

Post a Comment

Why is the front element of a telephoto lens larger than a wide angle lens?

A wide angle lens has a wide angle of view, therefore it would make sense that the front of the lens would also be wide. A telephoto lens ha...