Gray Scales

The adjacent image specifies 256 different shades of gray in a 16 x 16 grid. It is unlikely that you will see all 256 shades unless your browser runs on a 24-bit color display system. You should have no difficulty seeing the changes in gray level that do appear because of a visual effect known as Mach bands.

Grayscale images are images without color, or achromatic images. The levels of a grayscale range from 0 (black) to 1 (white).

Each pixel value in a grayscale image corresponds to an amount or quantity of light. In the realm of physics, the terms intensity or luminance are used to describe the energy density of light. The term brightness is often used to describe perceived intensity in the psychological sense of visual perception.

The relationship between pixel value and intensity can be nonlinear. For example, there is a non-linear dependence of the luminance produced by a CRT on the voltage of the input signal to the CRT controller since energy is proportional to the square of voltage.

The human eye is sensitive to the ratios of intensity levels rather than to absolute values in intensity. Brightness (perceived by the eye) and loudness (perceived by the ear) are both logarithmic functions of the intensity of the corresponding wave (light or sound).

Consider the settings of a three-way light bulb (50-100-150 watt). The step from 50 to 100 seems much greater in brightness than the step between 100 to 150.

The problem of displaying graylevel images is one of producing a set of equal steps in brightness.

Are these gray levels equally spaced?

Power law

Suppose we have a digitial image with 8 gray levels (3 bits) per pixel that we wish to display on a system where the gray scale ranges from 0 to 1.

We can represent the relationship between the input pixel value V and output display value I by a transfer curve, as shown in the following diagram.

For each input value, follow the dashed line up to the transfer curve then left to the corresponding display value.

Power law curve, where k is a scaling constant and "gamma" is the exponent

The gray scale patterns below were generated with three different values for the exponent "gamma". Which pattern looks most like a set of equal steps in graylevel? Your answer depends on the computer system on which you are viewing these images.

expon = 2
expon = 1
expon = 0.5

source code: GrayPower.cpp

Mach bands

In the image above, Mach bands appear at the boundary between squares of differing gray levels. Along the boundary the dark side looks darker and the light side looks lighter. The Mach band effect exaggerates the change in intensity at any boundary where there is a discontinuity in magnitude or slope of intensity.

Mach banding is caused by lateral inhibition of the receptors in the eye. As receptors receive light they draw light-sensitive chemical compounds from adjacent regions, thus inhibiting the response of receptors in those regions. Receptors directly on the lighter side of the boundary can pull in unused chemicals from the darker side, and thus produce a stronger response. Receptors on the on the darker side of the boundary, however, produce a weaker effect because of that same migration.

This diagram shows how the eye sees an abrupt step in intensity.


Written by: John Loomis
E-Mail address: loomis@udri.udayton.edu
Last updated: 25 Oct 1996