CRT Gamma

Wikipedia has an article on gamma at Gamma Correction which unfortunately has been totally corrupted now (imagining that gamma is to correct human eye response instead of correcting CRT response). Here is a much better mainstream article on gamma from the w3C. So this Wikipedia page is a real pity, but nevertheless, the Wikipedia article still includes this excellent graph from before it was corrupted:

Gamma06 600

The bottom curve is the response curve of the CRT monitor. This curve shows y = x to the power of 2.2. Specifically, the example is marked to show input (along bottom scale) of 50% is reduced (on CRT output screen) to only come out as 21.8% (along the left side scale). Darker data is shown even darker yet (generally disappears, by the mere act of showing it), and only the brightest data gets closer to its appropriate value. This is what is seen on the CRT screen, but the problem is caused by the electron gun inside the CRT. This is the gamma problem which the non-linear CRT response has, and which gamma correction fixes, to allow CRT monitors to be usable for tonal images.

To make the CRT show the data properly, all of our digital pictures are "corrected" by gamma encoding ... using the top curve. Low end values are boosted more than high end values, so that the corrected response of the top curve is the straight line in the middle (linear). The example is marked showing that input of 21.8% is boosted to 50%, and input of 50% is boosted to about 73%. Naturally, the point is, now 21.8% in is 21.8% out, and also 50% in is 50% out. (on the screen, to be again same as linear, same for the eye as what the camera lens saw in the first place). The world standards like sRGB require gamma 2.2, for this reason.

It has been said by good authority that there are other advantages of gamma encoding. Boosting the weakest signals also raised them above the noise level (analog television RF transmission), and the decompression step pushed the noise way down and became essentially noise suppression. Surely that was true for analog television transmission, but digital is one and zeros, and also has CRC protection around it, so my notion is that this stated advantage no longer exists for our digital pictures. Does not hurt anything though.

We may no longer use a CRT monitor, but nevertheless, all of our digital pictures still use this same gamma encoding system, and ALL of the digital RGB images in the world are already gamma encoded. Everything is still compatible, old images, and old CRT monitors too. The modern sRGB specification requires it. The point of my article is that we of course must expect to see these boosted gamma data values in our histograms. The mid-point is NOT 128.

Specifically, the math is this:

To use exponents, first we scale the tonal value to a percentage of full scale, specifically, to be a number between 0 and 1 (0 and 100%).
Note that zero to any exponent is still zero, and One to any exponent is still One. So the end points are maintained unchanged, but all the rest is rather different.

Gamma converts that 18% this way:

18% Gray card = (0.18 ^ 1/2.2) = 0.46. 46% of 255 = 117 on the gamma histogram.

117 is a little short of midpoint 128. Only coincidentally close to middle due to gamma in digital images, but the 18% was not close. Film did not have histograms or gamma, so it stayed at 18%.
Camera actions like White Balance, Contrast, Saturation, etc, shift the data and can change this number somewhat.

The center of the scale at 128 is 50% (of full scale 255), so
128 = (0.5 ^ 1/2.2) = 0.73. 73% of 255 = 187 on the gamma histogram. Closer to 3/4 than to 1/2. It won't be precise, because the camera's job is to modify it somewhat, due to white balance, contrast, brightness, etc.

We don't need to understand the math, but it really is fairly simple...

The curve representing the CRT response is: output = input ^ gamma (symbol ^ is to the power of gamma, which is 2.2 exponent)

The curve representing the correction to the data is: output = input ^ 1/gamma (opposite correction - new response is straight line in the middle - linear)

The exponent 2.2 is numerically near 2 (this value 0.5 squared is 0.25 instead of 0.218, but the idea is close). So a rough approximation of the concept is that the CRT shows the output value of the data squared, and the correction of the input provides the square root of the data value, to compensate, so the corrected response comes out a linear straight line. If that helps to see the concept.. the actual number is 2.2, called gamma.

CRT monitors are no longer as significant as in years past, however, all of the worlds RGB data is already gamma encoded, which is extremely significant, so we simply continue what we always did. Because - all of the existing digital image data has already been gamma encoded. So is all new data.

Menu of the other Photo and Flash pages here

Copyright © 2011-2015 by Wayne Fulton - All rights are reserved.

Previous Menu