0 - 255 Histograms

daveleo

what?
Local time
5:02 PM
Joined
Oct 20, 2010
Messages
3,692
Location
People's Republic of Mass.
I should know this (I thought I did) but I don't.

My DSLR displays a linear image histogram for each RGB color and also the overall "value".

After some stumbling about it, I find that neutral 18% gray = 128 on this histogram scale, half way between 0 and 255.

I am trying to calibrate my brain and I'm looking for the correlation between f-stops and 0 - 255. I cannot find what I am looking for.

If 128 = 18% (just about 2 1/2 f-stops down from white) how can I interpret the linear histogram shown on my camera's LCD in terms of f-stops ?

This is not an idle question, as I have been shooting manually with old lenses and finding the exposures are not what I expected.

Thanks in advance for any replies.
 
Dear Dave,

If I am reading you right, surely the histogram is logarithmic rather than linear? Wouldn't it HAVE to be, to fit 18% in as half way?

The point (again, as I understand it) is that perception (of greys) is indeed logarithmic, not linear.

Cheers,

R.
 
For an 8-bit JPEG:

255 - 128 = 1 stop
127 - 64 = 1 stop
63 - 32 = 1 stop
31 - 16 = 1 stop
15 - 8 = 1 stop
7 - 4 = 1 stop
3 - 2 = 1 stop
1 - 0 = 1 stop

The histogram is not linear; it's exponential (or logarithmic, if you prefer), base 2. So the range between 0 and 1 and between 128 and 255 both represent one stop, which is why you are advised to "use the bits" and "expose to the right" (i.e. so your stop of light is represented by more 'levels').

Remember, however, that all modern DSLRs are 14-bit, so the noise floor doesn't come quite as quickly as on older 12-bit cameras. That is to say, as bit depth increases, the real value is increased shadow detail; since the noise floor is fixed for a given sensor generation, the higher the bit depth, the further away shadow detail gets from that noise floor. Thus, with 14-bit (or 16-bit, as found in many digital MF backs), you're gaining 2 (or 4) stops of DR over the old 12-bit sensors, and that DR is manifested as better shadows (contrast this with film where the increased DR of negative films vs digital is manifested in better highlight retention).
 
Let's agree that I am confused, so maybe what I am saying is just wrong.

My confusion is that grayscale #128 = 18% gray, which (in photographic terms) is 2 and 1/2 stops down from white. But white = grayscale #255.

My question is: if the midpoint of my camera's histogram is #128 = 2 1/2 stops down from white (#255), where is one f-stop, 2 f-stops, 3 f-stops, etc down from white ??

I have to disagree with edge100 on this . . . 128 is NOT one f-stop down from 255 (actually that's what I thought until I saw the results). 128 is 2 1/2 f-stop down from 255.

Somewhere there is a chart listing grayscale number ( 0- 255) and f-stops down from white . . . somewhere . . . .

as a reference: http://www.luminous-landscape.com/tutorials/understanding-series/understanding-histograms.shtml
 
My confusion is that grayscale #128 = 18% gray...

The 128 doesn't refer to the 18% grey value on the card. An 18% grey card reflects about 50% of the light. That's all there is to it. 0-255 represent the range of an 8-bit value, so a value of 127 or 128 represents a measurement of 50% for the light being reflected.

Plus:
- since 50% of light is measured as 50% on the scale, it indicates that the histogram scale is linear.
- the exact number can vary a little bit depending on things like gamma.
 
Obviously, I have homework to do.

I always thought that one f-stop down = 50% of the light impacting the film (sensor). And that a gray card was 18% of "white" which is 2 1/2 f-stops down from white. (1 f-stop = 50%; 2 f-stops = 25%; 3 f-stops = 12.5%, etc etc) How 18% of the reflected light got to be 128/255 is beyond my understanding at the moment.

I'd sure like to see that list of grayscale # (0 - 255) versus f-stops down from white - which is what started me going on this quest.

My best guess is that on the digital grayscale meter ( 0 - 255) one f-stop = 51, which puts "gray" at 128 or so, if white = 255 and black = 0. But . . . I actually just made that up to fit the numbers 😀 .
 
An 18% grey card reflects 18% of the light falling on it. That's why it's called an 18% grey...

But because PERCEPTION is more or less logarithmic, if you ask people to rank (say) 21 cards with different reflectances from 5% to 90% (the highest you can realistically get), they'll put the 18% in the middle: a so-called Munsell mid-tone.

Cheers,

R.
 
The 128 doesn't refer to the 18% grey value on the card. An 18% grey card reflects about 50% of the light. That's all there is to it. 0-255 represent the range of an 8-bit value, so a value of 127 or 128 represents a measurement of 50% for the light being reflected.

True.

Plus:
- since 50% of light is measured as 50% on the scale, it indicates that the histogram scale is linear.
- the exact number can vary a little bit depending on things like gamma.

The histogram is not linear with respect to its relationship to photographic f/stops. If it were linear, then the difference between 255 and 128 (i.e. 1 f/stop) would be the same as the difference between 127 and 0. In reality, the latter represents 7 f/stops, ergo the scale is non-linear.

In an 8-bit system, 128 represents exactly one-half full scale, or put another way, 50% of pure white.
 
My best guess is that on the digital grayscale meter ( 0 - 255) one f-stop = 51, which puts "gray" at 128 or so, if white = 255 and black = 0. But . . . I actually just made that up to fit the numbers 😀 .

The problem is that it's not linear. The digital value of 1 f/stop can be as small as 1 (i.e. between 0 and 1) and as big as 127 (i.e. between 128-255), for an 8-bit system. That's the whole basis of analog-to-digital conversion: higher analog signals (brighter, in the case of light) are recorded with increased fidelity because they're represented by more digital levels than lower signals.

Now, if you increase bit depth (say, to 16-bits), now you have 65536 levels, and the same intensity of light that registered with a single level in your 8-bit system (i.e. 8 f/stops down from full white) is now represented by 512 levels, which is far above the noise floor, hence increased DR in the shadows.
 
I appreciate everyone who is taking time to comment here. I am still struggling to understand, and will continue reading up on this.

My recent camera experience does imply that (on a scale of 0 - 255) the middle value (128) shown on the camera's histogram is only one f-stop down from white. I say this because the images were consistently, uniformly over-exposed. This does agree with some of the above.

I still have some holes to fill in my thinking. Like how an 18% gray card is really reflecting 50% of the light hitting it ? ? That puts "gray" one f-stop down from "white"? All my life I thought it was 2 1/2 stops down from white.

Anyway . . . thanks all for your time, I will learn to use the histogram in the field even if I don't quite get the math that's going on.
 
I appreciate everyone who is taking time to comment here. I am still struggling to understand, and will continue reading up on this.

My recent camera experience does imply that (on a scale of 0 - 255) the middle value (128) shown on the camera's histogram is only one f-stop down from white. I say this because the images were consistently, uniformly over-exposed. This does agree with some of the above.

I still have some holes to fill in my thinking. Like how an 18% gray card is really reflecting 50% of the light hitting it ? ? That puts "gray" one f-stop down from "white"? All my life I thought it was 2 1/2 stops down from white.

Anyway . . . thanks all for your time, I will learn to use the histogram in the field even if I don't quite get the math that's going on.
It really, really isn't, and anyone who tells you it is, doesn't understand what they're talking about. An 18% grey LOOKS (about) half as bright, because perception is logarithmic. But in reality, it's reflecting -- gosh, what a surprise -- 18% of the light falling on it.

This whole minefield is known as 'psychophysics' -- what things actually look like to real people, not what instruments (or people who don't understand the subject) tell you they 'should' look like.

Cheers,

R.
 
To do the experiment properly, you need a large number of cards in varying shades of grey, from the darkest black you can get (typically 2-5% reflectivity) to the brightest white (just over 90% reflectivity). Arrange them in order from the darkest to the lightest. Pick the one you think looks most like a mid-tone. It will be 18% reflectance, or something close to it. This is because we're MUCH better at seeing small differences on something brightly lit than at seeing small differences in poor lighting. People can often tell the difference between two 'whites' (very light greys) that differ by 1/10 stopor less, but with 'blacks' (very dark greys), we may need 1/2 stop or more to see the difference.

Cheers,

R.
 
There is a lot of incorrect here

There is a lot of incorrect here

Here is the answer. Apparently this item is no longer on the web, but we owe many thanks to Julia Borg for creating it.
 

Attachments

  • gamma.jpg
    gamma.jpg
    75 KB · Views: 0
Back
Top Bottom