Chapter T wo General Methods.
2. General Methods.
2.3. Gamma correction.
In the following description the term "grey level value" is used to refer to the actual value present on the graphics card. For example, on the Matrox graphics board each image is represented by an array of 8 bit values in graphics memory, each of those 8 bit values may be termed a grey level value. Each grey level value produces a certain output voltage and each output voltage produces a certain luminance on the display. There are therefore two potential sources of non-linearity: firstly, the transformation of the grey level value into an output voltage; and secondly, the relationship between output voltage and luminance. Gamma correction was accomplished by measuring the display luminance produced by a
range of grey level values and fitting a function to the data so that the grey level value needed to produce a certain luminance could be calculated. In this way, both sources of non- linearity may be accounted for by a single operation. A number of devices were used to measure the luminance of the screens, these are detailed in the relevant chapters. For the Manitron/Matrox system and the Manitron/VSG system, a function of the form
p - k . r 2.1
was fitted to the data (p is the grey level value, k is some constant and y is a measure of the non-linearity). Taking the log of both sides of the equation gives the following:
log (p) = log (k) t Y-log (/) 2.2
which means that the logged data can be fitted to the function by simple linear regression. An exançle of gamma correction for the Manitron/Matrox system is shown in Figure 2.1a. Luminance was measured using a Graseby (UDT) model 265 luminance probe. As one can see, equation 2.1 provides a good description of the data.
Having derived values for k and y one can work out the grey level needed to produce any particular luminance value. In the majority of experiments the gamma correction process was applied during the calculation of the grey level values of the images stored on the graphics cards. For example, if one wished to produce a translating sine wave grating using the ramp plus LUT method described above, then the values in the space-time image would be calculated such that, when the ramp accessed the LUT, the luminance cross section of the image on the screen would be sinusoidal. The space-time image stored on the graphics card would contain a distorted version of a sine wave grating, the distortion would be dependent upon the gamma correction function.
For the Sun SparcStation LX, equation 2.1 did not provide an adequate fit for the data. In this case a cubic equation of the form
I =b^*b^.p ^b^.p^ *b^p^ 2.3
was fitted (where I is luminance, p is the grey level value and bg, bj, and bj are constants). As one can see from Figure 2.1b, this equation provides a reasonable fit for the data. The
60 -
Y = 0.460 A: = 39.15
§ 20 -
10 -
0 50 100 150 200 250
Grey Level Value
70 - 4.00 1.39 60 - I 5 0 - 0 % 40 - 1 30 - .70 .66
a 20 -
10 - 0 50 100 150 200 250Grey Level Value
Figure 2.1 : (a) An example of gamma correction for the Manitron/Matrox system, fitting equation 2.1 to luminance data. Values for k and y determined by linear regression are shown on the graph, (b) An example of gamma correction for Sun SparcStation LX, fitting equation 2.3 to luminance data. Values for bg, bj,6*2 and bj are shown on the graph.
Giey Level Value Calculated Lmninance. Value (cd/m^) 18.817101 19.102400 132 19.390100 133 19.680201 134 19.972799 135 . 20.267799 136 20.565300 137 20.865200 138 21.167601 139 21.472401 140
Table 2.1: List of grey level values and associated luminances. The luminance values were calculated by fitting equation 2.3 to the data in Figure 2.1b and then predicting the luminance from the fitted equation.
only problem with this formulation is that it is not easy to find what particular value of p is needed to produce a particular value of /. To evade this problem, the following procedure was used. For all the values of p from 0 to 255 a list of the respective luminances was calculated. A portion of this list is shown in Table 2.1. To take a concrete example, suppose a luminance of 20.4 cd/m^ was required. The nearest grey levels on either side would be found by applying some search procedure to the list. A grey level of 135 gives a luminance value of 20.2678 cd/m^ whilst a grey level of 136 gives a luminance value of 20.5653 cd/m^. One simple way of finding the necessary grey level is simply to use the one that will produce the closest luminance to that which is required. In the example given above this means that a grey level value of 135 would be used. However in the experiments described in this thesis, a more complex procedure was employed. This is described in the following paragraph.
The choice of grey level value would be determined probabilistically in the following manner. If is the required luminance value and 4,^ is the luminance produced by the nearest lower grey level and is the luminance produced by the nearest higher grey level then some value n exists such that:
K ora - ^ h ig h + (1 - (where 0 ^ ^ 1). 2.4
The value of n is given by the equation
I want - 1low ^ I high - Ilow
If the probability of choosing the grey value associated with is n and the probability of choosing the grey value associated with 4 ^ is 1 - n, then as the number of choices increases, the mean luminance of those choices will tend towards 7^^,.