Smooth Gradients and the Weber-Fechner Fraction

Whether the human visual system perceives a displayed slow changing gradient of tones, such as a vast expanse of sky, as smooth or posterized depends mainly on two well known variables: the Weber-Fechner Fraction of the ‘steps’ in the reflected/produced light intensity (the subject of this article); and spatial dithering of the light intensity as a result of noise (the subject of a future one).

The Weber-Fechner Ratio

It’s been known since ancient Greece that the daylight adapted human visual system responds logarithmically to light intensity.  In the 18th and 19th century  it was postulated and measured that just noticeable differences (JND) in intensity divided by the intensity itself remained constant over a wide range of lighting conditions.  This ratio is known as the Weber-Fechner Fraction.

Wyszecki & Stiles* show a nice graph of Just Noticeable Luminance Differences  by the human visual system in the range of interest to photographers viewing a displayed photograph on paper or off a monitor in typical conditions. dL/L in the chart represents the Weber-Fechner Fraction expressed as a percentage below which a slow changing gradient would appear as smooth to tested observers, meaning that no ‘posterization’ or contour banding would be perceived:

Weber-Fechner Fraction

Note how the adapted HVS just-noticeable luminance change remains relatively constant in photopic viewing  conditions  for, say, a 250:1 contrast ratio monitor set up to provide maximum brightness of around 100 cd/m^2  – arbitrarily shown as zero stops in the chart; 250:1 is about 8 stops – and how it gets larger as a percentage in the bottom few stops where the shadows reside.  It also gets a little bit larger past 10,000 cd/m^2, but not significantly.

1% in, 1% out

So let’s take a safe 1% JND as the threshold for gradient invisibility in adapted conditions, as Wyszecki suggests.

In a photographic context Luminance from a uniform patch of the scene is proportional to a certain number of photons per unit area, say per pixel, all other things being equal;  photoelectrons (e-) generated by a sensor are proportional to the number of photons incident on the average pixel; and, assuming certain conditions are met, values in the raw data are pretty well proportional to the number of e- generated by the average pixel.  Therefore ideally a 1% change in Luminance from the scene will be represented by a 1% change in the relative mean values of the captured raw data.

Ideally also, a 1% change in raw data values will be reflected by a 1% change in Luminance produced by the display medium  (monitor or print), closing the circle.  Gamma encoding to a colorimetric color space like sRGB effectively gets canceled out by the inverse function applied by the monitor or the printer.  So ignoring levels, curves and display medium contrast ratio for a moment, a 1% change in the mean number of photoelectrons generated  by a sensor, hence values in the raw data,  corresponds to a 1% change in relative Luminance reaching the viewer’s eyes.  The end-to-end imaging system is ideally linear.

The Last 100

Therefore if we assume linear raw data scaled to 8 bits for simplicity  since most video paths today are limited to this bit depth, a gradient of tones around the value of, say, 150 out of 255 should not produce visible posterization – because the maximum difference between contiguous tones is less than 1%: the difference between 150 and 151 is  0.67%.

Strip of linear intensity values from 150 to 189

Conversely a linear intensity value of less than 100 could show steps and not appear smooth. For instance from level 20 to 21  there is a 5% increase in intensity.

Strip of linear intensity values from 0 to 39

On my supposedly carefully maintained 8-bit video path the top strip appears pretty smooth, without any obvious posterization – while the bottom one definitely shows posterization steps in its darker regions.

If the top one looks posterized to you, your video path may be dropping a bit or two of information along the way.  If I stare long enough I can convince myself that I see a few vertical stripes here or there, but it may be just non uniformities or other monitor trickery.  Or perhaps my video path is not as well maintained as I think.

You can take a closer look by downloading the following 1800×400 file and displaying it through a well behaved viewer/editor.  Show it in the center of the monitor at 100% against a gray, ‘presentation’ background.  Stand a little further back from the monitor than usual.  If you use a browser make sure it is not zoomed (ctrl-zero in Chrome).

1800×400 strip of linear values from 0 to 200. Download and view against a neutral dark background.

The file at 100% fills up the majority of an HD display.  It is encoded with 2.2 gamma but untagged.  Most viewers assume sRGB gamma and therefore display it properly.  Since the intensity is linear on the horizontal scale you can tell approximately at what level the image starts appearing posterized: all the way to the left is zero, all the way to the right is 200, the center is 100, 1/4 is 50, 3/4 is 150,  you get the idea.   I can definitely see posterization up to about level 80 or 90 and possibly even beyond that.

So the 1% Weber-Fechner law seems to apply to my set up, keeping in mind that what is noticeable in these perfect synthetic images is much harder to notice in actual captures with ‘natural’ dithering, the subject of a future post.

By the way, what was shown above with 8-bit linear ‘raw’ data works just as well at 12, 14 or 16 bits, just scale accordingly.  The Weber-Fechner fraction remains of course unchanged.


PS Jim Kasson has a couple of posts with images that nicely show the perceptual effect of dithering on otherwise posterized information.


* Wyszecki & Stiles, 1982, p. 569