15

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?

MikeW
  • 33,408
  • 10
  • 88
  • 123

2 Answers2

17

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

mattdm
  • 143,140
  • 52
  • 417
  • 741
  • I understand that the color of the sky is a mix of RGB channels and that there is very little Red in that color. However, according to the histogram there should be a big amount of red (the spike is tall) and it should be almost black (the spike is on the left side). By looking on the picture I still can't see anything like that and I still don't understand how to interpret the histogram :( –  Apr 04 '12 at 17:11
  • 2
    @ClarityForce: take a look at the sliders I've posted. There is a very large amount of that almost-black red. It's a component of the teal color. – mattdm Apr 04 '12 at 17:14
  • Thank you for the update! Are you sure that the alignment of arrows is not just a pure coincidence? I thought that the horizontal position on the histogram should represent the tonal range, or brightness and not the color itself. If it's really the case, I would say that the RGB histogram is pretty much useless :( –  Apr 04 '12 at 17:19
  • 1
    I think I see the misunderstanding... don't think of the the spike as red "contributing darkness", but rather as red not contributing much to the brightness. The height of the spike represents the number of pixels in which the red value is a very small component of the color. Unlike the composite (luminance) histogram, the individual channels don't tell you a lot about the overall brightness, just the proportions of the color channels distributed in the scene. It can tell you about individual channel clipping and gross color shifts, but it doesn't directly reflect tonality. –  Apr 04 '12 at 17:24
  • @mattdm thank you so much for the updates and answering my questions. I really aprreciate that. I think that everything is 100% clear now. The main problem was to understand why the 'red spike' is so much far on the left from the 'green' and 'blue'. The color matrix you presented helped me alot: 28 (of 255) is a very low number (dark) and far away from 123 (green) and 142 (blue)! –  Apr 04 '12 at 17:45
  • @ClarityForce: does the software you're using have a hue histogram? And if so, does that do more of what you want? – mattdm Apr 04 '12 at 20:49
  • @mattdm It's Photoshop CS6 beta :) Isn't the 'Hue' the same as 'Colors' already? There are the following channels available: RGB, Red, Green, Blue, Luminosity, Colors –  Apr 04 '12 at 21:02
  • @ClarityForce: no. the Colors histogram is basically the R, G, and B histograms overlaid on the same chart (with CMYK where they overlap); the horizontal axis is still the channel value of that color. A hue histogram would have the "spectral color" as the horizontal axis, like this: http://chiselapp.com/user/saulgoode/repository/script-fu/wiki?name=sg-histogram-hue – mattdm Apr 04 '12 at 21:16
  • 1
    @mattdm Thanks for the link! I have also accidentally found this: http://blog.zillabyte.com/color-as-data/ and this: http://blog.zillabyte.com/hue-histograms/ –  Apr 04 '12 at 21:24
  • @ClarityForce: That's gorgeous! When I get a chance, I'll update my answer to bring more attention to that. – mattdm Apr 04 '12 at 22:08
4

I decomposed your image into its component colors in the GIMP with Color | Components | Decompose, to Color model: RGB and with 'Decompose to layers' checked. When I look at the individual layers, this is what I see:

red layer green layer blue layer

I guess that the bulk of each "color" is going into painting the background; the red layer is making the background all-black, which is why the spike is so far to the left, and the green and blue layers are more mid-grays. But... that's just a guess.

A more interesting histogram for you might require removing the background. I selected just the moon (by drawing a circle with the Ellipse tool), inverted the selection (Select | Invert), enabled transparency for the image with Layer | Transparency | Add Alpha Channel, and then pressed the Delete key to delete all the background. Now I get this histogram of just the moon:

rgb of moon-only