Wednesday, February 08, 2012

Histogram Myth explicated

Histogram Myth explicated: 

Many photography instructors and experts in the field are innocently and incorrectly making inaccurate claims, such as those three below, about how to interpret a histogram as seen on your camera’s LCD.  The representation that the “tonal x-axis value” is somehow logarithmic in scale, as suggested by bringing “stops” or “amount of light collected” into the discussion, is the cause of confusion.  By the very definition of what the histogram is, we should know that it is just a linear scale.  We can clearly see that this is the case just by watching the histogram shift on the camera LCD while stopping down.  I’ve known otherwise good photographers to give up trying to understand things in this field because they can’t comprehend what’s being thrown at them when histograms are being discussed by the experts… all the experts couldn’t be wrong could they?  Well, in this case, yes.  Those of you previously driven to insanity can now come back to school.

Claim: “You’ll lose half your tonal values for each one full stop of under-exposure.”  Wrong, losing half of your light by stopping down one stop, doesn’t mean you will lose half your tonal values.

Claim: “Fully half of the tonal values are in the brightest fifth of a histogram.  So, if you don’t have at least some pixels heading out into that rightmost fifth of the histogram, you’re wasting half of the potential tonal information that your camera can capture!

Claim: “If we array the stops of dynamic range along our monochromatic or luminance histogram, we’ll notice that each stop (from left to right) contains two times more information than the previous stop.  And notice also that most of the possible color values are in the brightest areas. That is, our camera can capture only a relatively few dark tonal values and lots of bright tonal values.”

Illustration: An example of the myth being propagated.

Histogram Stop Myth Illustrated - this is not a correct interpretation

Illustration is courtesy of, and many thanks to, Costa Rica photographer Greg Basco who was great in helping me to finally understand this issue as he tolerated my barrage of challenges with grace and patience.

I’ve seen this myth repeated over and over for years throughout the literature.  This stop metaphor applied to the interpretation of histograms is misleading and inaccurate, and may teach photographers poor technique.  The resultant implied prescription to not unnecessarily under-expose, because you’ll lose up to half your tonal values in just a one stop change, is quantitatively false, and may encourage photographers to overexpose their images in avoiding loss of tonal information that is in fact not as at-risk as implied.

By stopping down one stop, you are indeed capturing only one-half the number of photons, but you are not losing one-half of your measured and perceptible tonal values.  There is no argument that we should almost never intentionally underexpose an image if we can keep all pixel values withing the histogram and not blown out to the right.

A histogram is, by definition, a plot of frequency-of-occurrence of perceived brightness or tonal values of pixels, and you can see for yourself, say using live view (in a camera that has say just 5-stops of dynamic range) that as you stop down your camera, for each stop, the histogram shifts smoothly and linearly to the left by one-fifth of the horizontal-axis tonal value range.
That’s by definition of what the histogram does – it plots the frequency of occurrence of tonal values or perceived brightness of the pixels in an image.

 <<< below paragraph added for clarity 12 Jan 2012>> The key to understanding is to first define what the histogram is supposed to represent, including the terms used in the definition.  So.. if the definition of the histogram in this context is “the frequency of occurrence of tonal values plotted linearly“ then any claim that the horizontal-axis is not linear would immediately seem silly on the surface, as it indeed is.  And you can really clearly see in Liveview that the histogram as implemented by camera manufacturers, just scoots along in a nice linear fashion, as the lens is stopped down.  The histogram isn’t an abstract concept or metaphor, it’s a simple data visualization tool.  Each pixel in an image has a tonal value as perceived by a human in say a grey scale chart test pattern with 256 gradations from left-to-right.  The values range from say 1 or black at the left, to say 256 or white at the right.   If the brightest pixels are 256, and the darkest are 1, then 128 represents the tonal value of the center pixels of the test pattern.  There are by definition 256 tonal values.  To state that fully half of these values are found in the upper 1/5th or 1/8th portion of the plot (depending on your dynamic range model) is silly.  So once again, “losing half of your light by stopping down one stop, doesn’t mean you will lose half your tonal values.”  <<< this  paragraph added for clarity 12 Jan 2012>>

The dynamic range of the camera is totally accommodated and compensated for by this point in time in the internal systems production of a linear brightness scale (~luminosity) seen in the histogram.

The myth arises primarily because (1) people try to make photography more complicated than it is, and (2) it isn’t appreciated that human perceived brightness is a logarithmic function of the number of photons detected by a sensor.  Doubling the number of photons hitting pixels (by changing aperture by one stop) does not double the brightness.  Doubling the intensity (photon density) of a point of light does not double our perception of it’s brightness (this is a biological phenomenon), and similarly, by design, the conversion of voltages read out from a sensor chip takes this into consideration.

In the end, the histograms we see on the camera LCD and in Lightroom or Photoshop are just plots of the perceived brightness vs. frequency-of-occurrence of pixels.
Because photon-density vs. brightness is logarithmic and not linear in human perception, doubling the amount of light collected (or doubling the number of photons counted or equivalently the signal voltage created) does not double the perceived brightness (tonal level) quantized by the camera’s electronics and written into RAW or jpg values.   By definition, our camera and Photoshop histograms display the distribution of pixels by perceived brightness.

Laboratory assignment.  Prove this yourself.

To show this empirically, I downloaded a 10-tonal-level grey scale chart from the internet,  which has ten vertical intensity bands, then opened it in Photoshop, viewed Histogram, and selected regions over each pattern.
The histogram looks like a flat or evenly pulsed line, since the grey-levels are distributed evenly and the frequency of occurrence of pixels in each of these tonal value zones is equal in number to any other because of the design of the test pattern.
Photoshop quantizes the histogram view into 256 columns/containers for display purposes.
The RBG tonal values will be linearly different from sample pattern column to sample pattern column by about 28.4 on this projection to 256 plotting points (256/9), or 11% (100/9)
I measured (in 8-bits/channel RGB mode, these mean values)
0, 28, 56, 85, 113, 141, 170, 198, 226, 255
and converted to Grey-levels and measured in these percentages:
0, 15, 28, 41, 53, 64, 75, 84, 92, 100

Another example using a 21-tonal level test pattern
yields the same, as similarly expected, these linear values…
0, 13, 26, 38, 51, 64, 77, 89, 102, 115, 128, 140, 153, 166, 178, 191, 204, 217, 229, 242, 255  (~13 difference per step or 256/20=12.8)

So again, the top 1/5th values, in these cases,
[226, 255] and
[204, 217, 229, 242, 255]
range across 20% of the tonal range, not the 50% as claimed.