Maybe we shouldn't dwell on this, because it's not necessary nor greatly useful to know it to operate the scanner. But it might make the Histogram more comfortable to know a few more details, and to see a simplified example.
We want to measure the range of brightness of tones in our image, to help in setting shadow and highlight points. But absolute brightness is not very meaningful, because human eyes don't detect brightness linearly with color. Basically, we see Green as brighter than Blue. So, the term Luminance was invented, which is brightness adjusted to indicate appropriately what we really see.
Luminance is Gray tone brightness values computed from RGB via the formula:
RGB Luminance value = 0.3 R + 0.59 G + 0.11 B
This is the grayscale luminosity from converting RGB colors, from the NTSC (National Television System Committee) 2nd specification in 1953 for color television. It is the brightness that colors appear on a grayscale screen.
There are other variations of this formula used, with slightly different numbers, but this one is fine to make our point here. When you convert a color image to grayscale in your photo editor, the default Grayscale menu will use a method like this. Photo editors do typically give us other methods to drastically modify the result we find pleasing, but the accurate conversion will be like this formula.
For example, a RGB color of (100, 150, 200) would compute its luminance as
(100 x 0.3) + (150 x 0.59) + (200 x 0.11) = 140
But if the color were (100, 200, 150), the luminance would be
(100 x 0.3) + (200 x 0.59) + (150 x 0.11) = 164
Meaning, the color with more Green is brighter to the eye than the color with more Blue. The purpose of luminance is to show that difference.
The luminance signal in your TV set uses the same formula, in fact, that was its origin. Every RGB pixel computes to a 8 bit Luminance value between 0 and 255 (because 0.3 + 0.59 + 0.11 = 1.0).
This weighting is required because we see Green well, much better than we see Blue. Saturated Blue is dark to the human eye, and it doesn't contribute much to perceived brightness. Said another way, the sensitivity of the human eye peaks in the green-yellow colors. To make that point, here is a test image with all saturated colors (value 255). The Green is brighter than Blue or Red, even when mixed with Red or Blue. Actually, especially if it is mixed, because the Luminance value is proportional to the total of all of the RGB components, the weighted sum of all the components.
As seen on a grayscale screen
Converting to Grayscale makes the point that the colors don't have equal apparent intensities. These three primary colors all have the same intensity value of 255, but the perceived brightness is different. Blue has less brightness and Green has more. Green plus Blue (Cyan) has even more. And Green plus Blue plus Red (White) has even more luminance, it is brighter.
Note: In the RGB system, equal portions of
Blue and Green added make Cyan.
Red and Green added make Yellow.
Blue and Red added make Magenta (not shown here)
Blue and Red and Green added make White.
And here is a histogram of that sample image. It's exactly the same histogram for either image, because a histogram is a map of the grayscale Luminance values. I have added the gray gradient scale across the bottom to better illustrate the purpose, and the range of tones that the histogram is showing. The numbers run from 0 at the left (Black) to 255 on the right (White), which show the all of the shades of gray between Black and White. (BTW, you'll have to convert images to at least 256 color mode to be able to get a histogram).
Horizontally, the histogram horizontal scale is a bar chart count of the 256 possible colors, [0..255]. We suppose there are only seven colors in this image, so we expect seven luminance values (a real color photograph would have tens or hundreds of thousands of colors, depending on which colors were actually present). Drifting off subject, but technically there are actually are a few more colors causing the little bit of extra width of the vertical lines, which is because most RGB color images add intermediate mixed colors at color boundaries (called aliasing) to smooth the edge that can causes appearance of jaggies (stair-step edges on a diagonal straight line). And in JPG files, the added JPG artifacts cause extra color confusions.
The histogram shows a bar chart of the count of pixels with each shade of color. Normally, we do not care about the absolute count. We care about the trend, or the balance of all tones compared together. This very limited sample of 7 tones hides that, but it will become clear in the next step.
The blue area in our image is recognizable as the largest graphic area of the same color value, therefore has the most pixels, therefore it has the largest (tallest) spike. The height is the count of pixels in the image that have that one luminance value.
Blue should also have the lowest luminance (closest to the left or zero or black end). Blue's Luminance of 28 doesn't show much different than Black's 0 in the Gray tones, but it really is 28. Adjusting your monitors brightness and contrast can affect how it looks at your house, your monitor uses luminance too.
The "Max 2250" is the tallest peak, the blue in our case, which the chart below confirms has a pixel area of 2250 pixels. The histogram
graphs a bar chart of the count of the pixels with each possible tone.
My presentation unfortunately almost makes it look like the histogram is showing color. But it's not, it's showing Luminance of the colors. For example, if our Green sample were not saturated, if it had a RGB value of (0,100,0) instead of (0,255,0), then its luminance would be 0.59 x 100 = 59, which would be well less than our saturated Red sample. The histogram is showing the degrees of perceived brightness and darkness in our image.
For another example, the color Gray has the interesting property of having equal RGB values, with no color tint. So (50,50,50) is a dark Gray, and (200,200,200) is a light Gray. And Gray also has the characteristic that (50,50,50) has a Luminance of 50, and (200,200,200) has a Luminance of 200.
Here's a chart, made easy because of the solid saturated colors in our test sample. It has been sorted in order of increasing luminance. You can see the calculated values agree exactly with the histogram scale.
Color | Area Size in pixels | Area in pixels | RGB Color | Luminance | |||
from Red | from Green | from Blue | Total | ||||
K | 53x30 | 1590 | 0, 0, 0 | 0 | 0 | 0 | 0 |
B | 75x30 | 2250 | 0, 0, 255 | 0 | 0 | 255 x 0.11 | 28 |
R | 66x30 | 1980 | 255, 0, 0 | 255 x 0.3 | 0 | 0 | 76 |
G | 59x30 | 1770 | 0, 255, 0 | 0 | 255 x 0.59 | 0 | 150 |
Cyan | 39x30 | 1170 | 0, 255, 255 | 0 | 255 x 0.59 | 255 x 0.11 | 178 |
Y | 40x30 | 1200 | 255, 255, 0 | 255 x 0.3 | 255 x 0.59 | 0 | 227 |
W | 52x30 | 1560 | 255, 255, 255 | 255 x 0.3 | 255 x 0.59 | 255 x 0.11 | 255 |
A real photo has a complicated histogram, so before we rush out into the real world, let's take a halfway step.
The small red image above is a small JPG file and its corresponding histogram. Actually, the histogram is from its TIF file, because the JPG image introduces artifacts that confuse the discussion of it. It is a graphic gradient ranging from Red (luminance about 80) to White (luminance 255). Again, the histogram just graphs a bar chart of the count of the pixels with each possible luminance tone. And in our real photos, it's not the count that's important, but instead the shape of the curve, how the masses of light and dark pixels contribute to the total. Obviously this bright test image has tones fairly evenly distributed in the upper 2/3 of the range, and is quite barren in the low 1/3.
You can see the largest peak value is Black at 0, which is the two lines. Black is the largest single pixel count in this image. That's perhaps a little surprising due to its limited area, but Black is the only constant color in this image, those pixels are precisely 0 value. The rest of the pixels are all graduated colors, each a little different, spread over very many possible color values, since the gradient concept is of varying colors. The next largest count is the White pixels (near 255), that seems apparent at the right end of the image. Also the large value of almost saturated Red at about 88 at the left end of the image. The deepest Red is in the upper corner, so its area in pixels is very small, and it's not until a less saturated shade that we have significant pixel count. In between is the spread of the gradient fill, which adds blue and green to approach white. And we have no darker values in this image than about 85, because the idea of this Red fill is to start at (255,0,0) and shade gradually to (255,255,255). We cannot get darker than Reds luminance in this image, actually we slightly missed that. These details I mention have no importance of their own, but if you can follow them, then you understand histograms!
So, gray tone range in Luminance values is used by the histogram to map, or to tell us about the actual distribution of, the range of light and dark tones in our color images. Photographs generally have more nearly all luminance values represented, where both of these samples were intentionally limited, to be able to better show the details better. Hopefully, you have a better idea of what the histogram is showing now.
If we are interested in the range of tones that we have in a photograph, the histogram shows that at an easy glance. What it has, and what it needs.