# Human Brightness perception and contrast

This is kind of an interdisciplinary question on human brightness perception and the ability to distinguish grayscales. To be honest, I wasn't sure if the Physics, Biology or Computer graphics SE site are better suited (it touches a bit of all), but I'm sure that astronomers are facing quite the same question, so let me try here first to explain my problem (and please direct me to a better fitting community in case...):

On the one hand (1):

It is well known that human perception of brightness is logarithmic. In astronomy I think you even go with $$2.5 \cdot log_{10}(...)$$, but I'm plotting here (Figure 1) the CIELAB 1976 definition, the formula can be found on Wikipedia:

Figure 1 nicely shows that the slope is much larger at small luminances. This means the eye perceives brightness changes more pronounced when it is low luminance changes (which is explicitly mentioned in various sources, e.g. here for LEDs). So for example, when increasing the output power of a LED from 1 mW to 2 mW the perceived change is larger than increasing it from 10 mW to 11 mW. As a consequence of the curve's shape, "middle gray" is perceived already at 18% luminace, which I included as a dashed line in Figure 1 (indeed, the dashed line crosses the blue line at Lightness = 50). This is also well known in photography and I guess important when it comes for example to tonemapping of high dynamic range images.

On the other hand (2):

There have been extensive efforts in medical imaging to find out how well observers can discriminate between gray levels. They came up with a Grayscale Standard Display Function (GSDF). I found this paper, which is not behind a pay wall. However, I have no clue about copyright issues, so instead of copying the GSDF I reproduced it here as Figure 2, the formula is provided in that paper (where it is Fig. 2 as well). The unit of the x-axis is the just noticable difference (JND), which is gray levels that 50% of obersvers would perceive as different gray levels.

It turns out that the average human observer can discriminate about 1000 gray levels in the range from 0 to 4000 $$cd/m^2$$ (a normal display has only 256 gray levels, but there seems to be better displays in the imaging sector for obvious reasons). The GSDF in Figure 2 (logarithmic luminance axis) is again logarithmic. In particular it shows that between 0.1 and 10 $$cd/m^2$$, i.e. two orders of magnitude, a human observer can discriminate between 200 JND, whereas in the next 2 orders of magnitudes (10 to 1000 $$cd/m^2$$) we can distinguish 600 gray levels. This means, the eye distinguishes better for large luminance levels (which is also explicitly mentioned in the cited paper).

Question: For me, (1) and (2) are in clear contradiction, because (1) tells me the eye performs better distiguishing changes at small luminances, and (2) tells that the eye performs better distinguishing gray levels at large luminances. Nevertheless, both curves are correct. Where is my misconception?

Self test: I already tried a self test and plotted different gray levels next to each other (Figure 3). The outcome is, that I can indeed better see differences between the large grayscales. In particular, I can see the difference between 250 and 255, but I can almost not see the difference between 0 and 5. And "middle gray" really looks like middle gray (plotted here 125, the true middle gray would be 127).

However, it is clear that these gray levels depend on the amount of light that the monitor emits for the respective gray level. So I measured for each gray level the optical power using a powermeter that I put directly in front of the monitor, which is a commercial standard 8 bit computer monitor for office work. The result is plotted below in Figure 4 with the gray levels on the x-axis, and the measured optical power in Watts on the y-axis. I also converted on the second y-axis to $$cd/m^2$$ by dividing the measured power by the detector area $$A_{detector}$$ and $$\pi$$ because the display is certainly a Lambertian emitter, i.e. $$radiance = \frac{P}{A_{detector} \cdot \pi}$$, and multiplied this by 683 to convert from $$\frac{W}{m^2 \cdot sr}$$ to $$\frac{lm}{m^2 \cdot sr} = \frac{cd}{m^2}$$ (which works of course only for green light of 555 nm, whereas the monitor emits a RGB spectrum, but anyways...).

Obviously, the monitor doesn't emit linearly, but shows more like an exponential shape with small luminance changes between small gray levels, and increasing luminance changes at large gray levels. No idea why, I speculate they do it on purpose to compensate for the logarithmic perception of brightness plotted in Figure 1 and give the perceived gray levels a more linear behaviour (if anyone knows, please correct or confirm). The maximum luminance is 170 $$cd/m^2$$ and 18% of this is 31 $$cd/m^2$$, and indeed for middle gray (= 127, indicated by dashed line in Figure 4), the luminance is close to 31 $$cd/m^2$$ (more like 35...), so that would more or less fit. But pure speculation... and didn't help my basic question how Figure 1 and 2 can be true at the same time as being in contradiction...

Update:

After receiving comments below pointing me to a really interesting blog about gamma correction, I tried to apply it to the data in Figure 4 in order to reproduce the measured shape of the graylevel vs. luminance graph. The magenta line in Figure 4 is calculated from normalized gray levels (i.e. dividing every gray level on the x-axis by 255 so that the input is in the range 0..1) according to $$gray_{norm}^\gamma$$ with $$\gamma = 2.2$$ as suggested in the blog. The line is then scaled by max and min luminances to fit to the range of measured luminances.

Obviously, the pink line matches the green line very good. This implies that the monitor emits light not linearly but according to the gamma correction on purpose to compensate for the nonlinear human brightness perception plotted above in Figure 1. In the blog it is also nicelay demonstrated how the human eye would perceive a true physical linear emission: Very few dark colors and everything shifted to white colors (because of the perception shown in Figure 1). But as the monitor emits this nonlinear way, the perceived grayscale becomes linear with equal numbers of dark and bright colors.

So the self-test question and connection between Figure 1 and 4 is solved. But the main question, how Figure 1 relates to Figure 2, remains.

• Yes, monitors have settings to adjust gamma and brightness - and people pay a lot to get their equipment properly colour calibrated. Usually a pixel value of 100 is not necessarily half as bright in physical units as is a pixel with a value of 200 (especially in white as that always is a mix of 3 colours and colours can often be adjusted separately). The monitor adjustments indeed are meant to compensate for human perception. Commented Jan 2 at 15:14
• The 256 grey levels in sRGB are definitely not linear. They're mostly adjusted with a fixed exponent, except for the darkest levels. Here's a great article (aimed at programmers) on gamma-corrected luminance. blog.johnnovak.net/2016/09/21/… Commented Jan 2 at 23:02
• @PM2Ring Many thanks, this blog is really helpful. I tried the gamma correction on my data and updated Figure 4 accordingly. Looks good! So half the mystery is solved, but the main question remains, that is if Figure 1 and 2 are in contradiction. Commented Jan 3 at 8:43
• Did you subtract the luminance of the background? This is important if you are looking for a logarithmic effect. Did you ensure that the lowest level then is above human threshold? The first curve is obviously not logarithmic at 0 luminosity. Commented Jan 5 at 14:56
• @eshaya The first 3 Figs are pure simulations, only Fig 4 is measured and might have some contribution from ambient light (since gray value of 0 gives slightly > 0 W measured power in Fig. 4). But it's very small... Commented Jan 7 at 10:59

After some time I found the answer:

Actually the CIELAB definition in Figure 1 in my question and the Grayscale standard display function in Figure 2 are quite similar, if the x and y axes of the CIELAB line are swapped and the y-axis is then plotted in logarithmic scale:

In the Figure 1 in my question the Luminance was normalized to the interval 0..1. For this plot I just identified 0..1 with the luminances from the GSDF (up to 4000 $$cd/m^2$$) to share the same y-axis. The CIELAB definition also gives the Lightness in the range 0..100 whereas the GSDF is in JNDs. I therefore plotted a second x-axis. However, the general shape is quite similar, with the difference of the CIELAB line to have a larger slope in the beginning. This is also nicely described and discussed in this report (page 80, Fig. 42).

So both lines describe the same. My question was, why CIELAB (in linear scaling) seems to indicate that the eye works better distinguishing between low luminances (dark gray values) and GSDF indicate that the eye works better distinguishing between bright gray levels.

The confusion arises from the logarithmic y-axis of the GSDF plot, which seems to indicate that there are more JNDs for large luminances, for example:

1. about 200 JNDs from 0.1 to 10 $$cd/m^2$$, but
2. 600 from 10 to 1000 $$cd/m^2$$

which was the example in my question. However, in the first case we have only 9.9 $$cd/m^2$$, but 990 $$cd/m^2$$ in the latter case, so it’s absolutely no wonder that there are more JNDs. When plotting the GSDF with linear y-axis it becomes clear:

So the majority of JNDs os obtained already for very small luminances. This is in perfect agreement with the initial Figure 1 in my question above and the resulting finding that the eye performs better in the dark (resp. the eye perceives differences between low luminances better).

The point is, computer displays don’t work linearly (as demonstrated by measurements in Figure 4 in my question), because they try to compensate for the logarithmic sensitivity of the eye. If they would work linear, we would perceive very few dark gray values only and the rest is already whitish, so everything is shifted. Instead, the optical power a display emits is more exponentially (again, see Fig. 4 above), which results in

1. The perceived grayscale is not shifted but centered around middle gray with equal numbers of dark and white gray levels.
2. But (because of the exponential increase of the emission as function of gray value, see Fig. 4 in the question) we need to consider the CIELAB or GSDF line in the plot with logarithmic y-axis, where a commercial monitor might cover luminances over 2 orders of magnitude and more JNDs are then found on the white side, so now we see contrast between bright gray levels better.

To demonstrate how a grayscale would look like on a monitor with linear increase of emitted photons, I added a second grayscale to Figure 3 from my question:

The first grayscale is the same as in the original Figure 3. The second grayscale is for linear increase. As the monitor actually has an exponential increase, many gray values are omitted in the beginning, while the steps decrease then. I calculated the second grayscale from the measured monitor luminance in Figure 4 by just dividing the maximum measured luminance by the number of steps I want to plot (12 in this case), and searching for the gray value in Figure 4 where the monitor emits the respective step's luminance. It is nicely seen that now we have in principle only one dark gray level left, middle gray is not in the middle, and everything is shifted to whiter levels. These gray values are now equally spaced in terms of true physical emission (number of photons), and I see differences better at the dark side.

So the eye works as I thought, but when using monitors behaving like the one I measured (think this applies to almost every commercial monitor), we can distinguish better between white instead of dark colors, although this is vice versa for real (linear behaving) light sources.