<A HREF="COL_.htm"><img align=center src="contents.gif" ALT="Contents"></A> Previous Next


Gamma and linearity.

Many image processing operations, and also colour space transforms that involve device independent colour spaces, like the CIE system based ones, must be performed in a linear luminance domain. By this we really mean that the relationship between pixel values specified in software and the luminance of a specific area on the CRT display must be known. In most cases the CRT will have a non-linear response. The luminance of a CRT is generally modeled using a power function with an exponent, gamma, somewhere between 2.2 (NTSC and SMPTE specifications) and 2.8 (as given by Hunt and Sproson). Recent measurements performed at the BBC in the UK (by Richard Salmon and Alan Roberts) have shown that the actual value of gamma is very dependent upon the accurate setting of the CRT's black level. For correctly set-up CRT's, gamma is 2.35 +/- 0.1. This relationship is given as follows;

	Luminance = voltage ^ gamma
Where luminance and voltage are normalised. In order to display image information as linear luminance we need to modify the voltages sent to the CRT. This process stems from television systems where the camera and receiver had different transfer functions (which, unless corrected, would cause problems with tone reproduction). The modification applied is known as gamma correction and is given below;

	New_Voltage = Old_Voltage^(1/gamma)
(both voltages are normalised and gamma is the value of the exponent of the power function that most closely models the luminance-voltage relationship of the display being used.)

For a colour computer system we can replace the voltages by the pixel values selected, this of course assumes that your graphics card converts digital values to analogue voltages in a linear way. (For precision work you should check this). The colour relationships are;

	Red  = a * (Red'^gamma) +b
    	Green= a * (Green'^gamma) +b
    	Blue = a * (Blue'^gamma) +b
where Red', Green', and Blue' are the normalised input RGB pixel values and Red, Green, and Blue are the normalised gamma corrected signals sent to the graphics card. The values of the constants a and b compensate for the overall system gain and system offset respectively. (essentially gain is contrast and offset is intensity.) For basic applications the value of a, b and gamma can be assumed to be consistent between colour channels, however for precise applications they must be measured for each channel separately. A more accurate description of the gamma relationship has recently been given in a paper by Berns. See also Charles Poynton's paper and his document GammaFAQ. The implementation of gamma correction for television standards is discussed more fully in section .

Note: Gamma correction performed in integer maths is prone to large quantisation errors. For example, applying a gamma correction of 1/2.2 to an image with an original gamma of one (linear luminance) produces a drop in the number of grey levels from 245 to 196. Therefore take care not to alter the transfer characteristics more than is necessary, if you need to gamma correct images try to keep the originals so that you can pass them on to others without passing on the degradations that you've produced ;-). In addition, any implementation of gamma correction which takes no account of the transfer function of the image acquisition system, is an incomplete implementation.