How many stops are there between middle gray and white, and how does RGB/gamma affect that?

Asked 4/15/2015

3 views

2 answers

0

I'm trying to understand stops, dynamic range, middle gray, and why RGB values don't map directly to light linearly. For example, if middle gray is around 18% reflectance, how many stops is it below white? Why does that not appear halfway in an 8-bit RGB scale or histogram? How do gamma encoding and color spaces like sRGB or Adobe RGB affect the relationship between RGB values and exposure stops?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

11y ago

2 Answers

9

Intro
Based on your questions, I get the impression that you miss one important point, and that is the difference between:

  • light perception in the real world,
  • light perception in the world as humans perceive it,
  • light percetion as your camera's sensor records it,
  • light perception as image formats and your computer perceives (or processes) it.

The real world has a huge amount of stops between black-point and white-point. Distant stars emit only a few photons per second at us while the sun blasts about 10^17 photos per second at us. That's about 57 stops(!). Humans eyes can see around 10 to 14 stops of dynamic range at any moment (source) and around 24 stops when we have the time to adjust our eyes (source). The sensors of DSLR's are just below that (8-11 stops). Smaller sensors often have a lower dynamic range. Digital image processing at 8 bits has exactly 8 stops of dynamic range.

Trying to answer your questions
I'll try to answer your questions as good as I can. My objective is to give you insight rather than just giving you a straight answer, because I think that best fits the intent of your question(s).

  • How many stops of light are there between the black point, RGB(0, 0, 0), and the white point, RGB(255, 255, 255)? Is that the same as the camera’s dynamic range as measured by DxOMark?

There are 8 stops between RGB 0 and RGB 255 if your gamma is 1. For example if I use Photoshop to brighten a RGB (119, 119, 119) color using the Exposure function to RGB 255, I need to add +2,42 stops. But I need to underexpose -11,48 before I get to RGB (0,0,0). If you have the Info panel open and your color picker at the patch of color while sliding the exposure meter, you'll see that the RGB values change faster when adding exposure and slower when sliding the exposure down. As mentioned in @Fumidu's answer, the is because of the default gamma value of 2,2.

  • How many stops are there between the middle gray, which is RGB(119, 119, 119), and the white point?

As you are talking about RGB values, you are in the computer processing world. Stops are translations from the real world (twice as many light) to digital images. Bottom line, this depends on how your computer (and your imaging software) handles "exposure". In other words: this depends on the gamma. My experiment in Photoshop resulted in +2,42 stops. But that's how Photoshop handles gamma and exposure. Based on the idea the one stop is twice as many lights and if you assume a gamma of 1 (double light means double RGB values), it's ( ln(255)-ln(119) ) / ln(2) = 1,1 stops (rounded to 2 digits). You can just multiply by the gamma, if that's not 1. Based on gamma 2.2, it's 2,2 * ( ln(255)-ln(119) ) / ln(2) = 2,42 stops, which matches my experimental outcome in Photoshop.

  • Does the distance in stops between the middle gray and the white point depend on my camera model?

Yes. The depends on two things:

  • The dynamic range of your camera
  • The way your camera handles ISO in relation to dynamic range

If your dynamic range is 10, you have 5 stops below mid gray and 5 stops above. But based on the ISO value, you camera might give some more priority to the shadows and offset the mid gray, so for example at ISO 800, you have 6 stops below mid gray and 4 stops above it (to capture more shadow detail at the expense of the risk of highlight clipping). Here is an article explaining this for a video camera, but digital photo camera's do exactly the same.

  • How can I measure the actual distance in stops between the middle gray and the white point at home?

Setup your camera on a tripod or steady surface. Put a piece of white paper in front of the camera. Make sure the piece of paper is evenly lit and that the light source is constant and preferably quite white (or adjust your white balance). Put your camera in manual mode, set the ISO fixed on 100 ISO, put the aperture at some reasonable value (5.6 or 8 would be great) and start taking shots at different shutter speeds. Measure the pixel brightness (RGB value) and note how many stops there are between (almost) black exposures (<10 RGB value) and (almost) bright exposures (>250 RGB value). There you have the dynamic range of your camera.

This article explains it in a bit more detail.

  • How can I calculate the theoretical distance between the middle gray and the white point based on a camera’s specs and someone else’s measurements?

As a rule of thumb: 5 or 6 stops would be a good guess for DSLR's (4 or 5 for compact camera's). If you know the dynamic range, it's half the dynamic range. Subtract one stop for high ISO (800-6400) and 2 stops for extremely high ISO (6400 and up).

The problem is that dynamic range is often not part of the specifications of the camera. Also the way the camera handles high(er) ISO ratings is part of the processing magic of a camera and often not publicly available. Long story short: an general educated guess comes quite close. Calculating it is (because of unavailable specifications) practically impossible.

  • In general, how to calculate the distance in stops between an RGB(n,n,n) gray and an RGB(m,m,m) gray?

stops = gamma * ( ln(n) - ln(m) ) / ln(2)
ln is the natural logarithm; but if you prefer, you can use log too, which will give you the same results.
So from 119 to 255, it's n = 119, m 255, gamma = 2.2, stops = 2,42.

  • How to add or subtract a specific number of stops to an RGB(n,n,n) gray without Lightroom?

Using the above formula, you can use any software or programming tool to do this. Not sure what you're looking for.

  • Where can I learn all of this on my own? Any book or online course recommendations?

This is highly personal, but a few of my favorites are:

Originally by user31874. Source · Licensed CC BY-SA 4.0

user31874

11y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

A stop is a doubling or halving of light. In linear light terms, 18% gray is about 2.5 stops below white, because 100% → 50% → 25% → 12.5%, and 18% falls between 25% and 12.5%.

The key confusion is that camera exposure and sensor data are linear, but most RGB image values and camera histograms are gamma-encoded, not linear. So middle gray does not appear at half the RGB scale. With typical gamma encoding, 18% gray lands around 46% of the 0–255 range, roughly RGB 117–119, not 128 because it is “halfway in light.”

Also, RGB(0,0,0) to RGB(255,255,255) in an 8-bit image is not the same thing as a camera sensor’s dynamic range. Sensor dynamic range is about how many stops of real-world brightness the sensor can capture before clipping highlights or losing shadows in noise. JPEG/8-bit output uses gamma compression to fit a wider tonal range into fewer code values in a way that better matches human vision.

So:

  • stops are calculated from linear light ratios
  • RGB code values in JPEG/histograms are usually gamma-encoded
  • the exact RGB number for a given stop value depends on the tone curve/gamma
  • this is separate from the camera’s true sensor dynamic range

UniqueBot

AI

11y ago

Your Answer