High Resolution Colors

Precise stimulus control in visual experiments requires an exact specification of the stimulus intensities and their colors. Most PXL programs specify their visual stimulus colors by standard CIE xy-chromaticity coordinates and the intensities by luminance values. These type of coordinates are called xyL-coordinates in the PXL documentation. This refers to a triple of numbers where the first two give the xy-chromaticity coordinates of the stimulus and the third gives the luminance value. This specification is unique in the context of video displays, since the stimuli that may be created on a video screen form a subset of a three-dimensional manifold.


Insert Table ebu here.

This is not the place to give a complete introduction to the CIE chromaticity chart. The reader must be referred to special literature like Wyszecki (1982). Figure cie shows the CIE chromaticity diagram with the color coordinates of standard video phosphors. Table ebu gives the coordinates of the standard European Broadcasting Union phosphor coordinates and the coordinates of the so-called D_65 reference white.


Insert Figure cie here.

In order to generate correct physical stimuli from a xyL-coordinate triple several prerequisites must be met:

  1. The xy-chromaticity values of the color display device's primaries must be known. Measurement of these coordinates is rather complicated and usually not feasible for psychological laboratories (Brainard, 1989). Approximations to the correct xy-coordinates may be available either through information from the tube manufacturer or from the standard norms for color TV sets. Information from manufacturers usually is only available for rather expensive monitors. The standard EBU phosphor coordinates for color TV sets are given in Table ebu. The table also contains the xy-coordinates of the standard D_65 white with a correlated color temperature 6504 K.
  2. Luminance measurements of the video display must be available. The proper way to specify the visually effective intensity of areal stimuli on a video screen is luminance as measured in cd/qm. The appropriate device for measuring the luminance is a photometer provided its sensitivity is calibrated according to the sensitivity of the visual system as defined by the V(L) luminous efficiency function.
  3. It must be guaranteed that the video display device works additive. Only then is it possible to compute the stimulus coordinates from the component coordinates. Video color display devices have three different pigments: red, green, and blue ones. If the coordinates of each component are known one can compute the resulting mixture's coordinates by vector addition. However, the results of these additions are only valid, if the physical device is actually additive. Real devices will never be perfectly additive, such that one has to be satisfied if there are only small deviations from additivity. For video displays this means that one has to be careful not to drive a monitor into extreme intensity ranges. Some monitors may even have a compression mechanism that delimits the gun intensities. Driving the monitor into the range where this compression becomes active will result in strong additivity failures.

Color Device Installation

Programs that use color coordinates need to know the characteristics of the color device they have to work with. There are two different sources for these programs where they get their information from. The first one is a set of experimental variables that specify the xy-chromaticity coordinates of the color device's primaries. These variables usually will be set in the startup file startup.pxl. Here is an example from a startup file for a standard EBU-phosphor monitor:
   redprimaryx = 0.6400
   redprimaryy = 0.3300
   redprimaryL = 78.80
   greenprimaryx = 0.2900
   greenprimaryy = 0.6000
   greenprimaryL = 242.00
   blueprimaryx = 0.1415
   blueprimaryy = 0.0482
   blueprimaryL = 33.30
This file not only specifies xy-values, but also gives luminance values. The parameters redprimaryL, greenprimaryL, and blueprimaryL give the maximum luminance which is possible with the respective channel of the color display. Thus the above values tell a PXL program that the red channel of the given color device may produce luminance values up to 78.8 cd/qm. Adding the three luminance maxima results in a maximum intensity of 354.10 cd/qm for a white stimulus.

Specifying luminance values in the startup file for the color device requires actual luminance measurements from the video screen. If these are not available, then it may be a good idea to set the maximum luminance values for the three color channels such that they sum to 100.0 and their ratios are equal to the luminous efficiency values of standard EBU phosphors. Values that satisfy these conditions are

   redprimaryL = 22.19
   greenprimaryL = 70.68
   blueprimaryL = 7.13
This will result in "luminance" values that actually are proportions of the device's maximum intensities given in percent, since maximum intensity for each channel results in 100 units of "luminance".


Insert Figure gammafun here.

Gamma Correction

Knowledge of a device's primaries and their maximum luminance values is not enough for creating stimuli of arbitrary intensities in the admissible range. The reason is that the relation between luminance output and voltage input for the phosphors of video tubes is not a linear function as demonstrated by Fig. gammafun. The luminance output is a positively accelerated function of voltage input. It approximates the function L = E^2.3 and is called the "gamma function" of a video tube. A linear mapping of color coordinates to screen luminance values has to take the gamma function into account. PXL is able to use external gamma tables in order to linearize a color device. The gamma tables have a special format and there is a special application called rgb that may be used to create gamma table files. The table format is described in the documentation of rgb in Chapter rgb.

Gamma tables depend on the graphic controller because the number of different luminance values for a single color channel depends on the resolution of the graphic controller's digital to analog converter for the color channel. IBM VGA compatible controllers have 6 bit DACs with 64 intensity levels per channel. More advanced controllers like TIGA devices, some workstation graphics systems, or even most of the new SVGA boards have 8 bit per color channel and 256 intensity levels. The gamma tables created by rgb contain the luminance output value for each level of output voltage intensity for each color channel. Thus a 256-level table contains 768 luminance entries. It also has a header that contains the device primaries, its maximum luminance values and a scaling factor for the luminance entries in the table. The header information is used to set the experimental variables described in the previous section that give the xy-chromaticities of the device and its maximum luminance values. Thus loading a gamma table replaces the values of these variables.

The gamma table files created by rgb are binary files. There also is a method to specify gamma tables whithin parameter files in the same way as any range valued parameter my be defined. The parameters used are redgammatable, greengammatable, and bluegammatable. These are float type parameters which must be range valued and contain exactly as many entries as there are possible output levels for each color channel. These parameters should be set in the file startup.pxl. This method of setting gamma tables allows only for a single gamma table for each display. As described in the following section, PXL programs may use multiple gamma tables depending on the drawing indices used. However, the assignment of multiple gamma tables to drawing indices is possible only with binary gamma table files.

Finding Gamma Table Files

There are two parameters involved in finding gamma table files. The parameter gammatable contains the name of the gamma table file. gammatable may be an array of file names. In this case the array gammaindex associates a gamma table file in gammatable with each drawing index. Graphic programs need color index values for drawing. gammaindex is an array of numbers. Each number in gammaindex gives the gamma table file (by its position in gammatable) which is used for index values given by the number's position in gammaindex. Thus if there are more than one color patches on the screen each patch may have its own gamma table. This makes it possible to control for irregularities of the luminance response at different screen positions. Here is an example for the program cds: Suppose there are 3 color patches on the screen and each position has its own gamma table g1.tab, g2.tab, and g3.tab. These have to reside in directory pxl\etc . The target field drawing indices of cds start with 4 such that the three target fields correspond to drawing indices 4, 5, and 6. The indices 0, ..., 3 are used for background, text messages, adaptation fields and the fixation mark respectively. We associate gamma table g1.tab with these indices:
   gammatable = ["g1.tab", "g2.tab", "g3.tab"]
   gammaindex = [0, 0, 0, 0, 0, 1, 2]
The array gammaindex tells PXL to use table g1.tab for indices 0, ..., 4, g2.tab for index 5, and g3.tab for index 6. Thus the different gamma tables may be used for controlling irregularities of the monitor's luminance response at different screen positions.

Gamma table files are located in the directory pxl\etc whose actual location is controlled by the value of the environment variable PXL. This directory should contain a gamma table file called gamma.tab that is appropriate for the color device connected to the system where PXL is running on. The exact behavior with respect to gamma tables, however, depends on the specific application and should be described in the application's documentation. The reason being that some application's don't need precise color coordinates but others do.

Computed Gamma Tables

If no gamma table file is found and no gamma table is specified by parameter values, then the high resolution color initialization software will create a default table based on an equation suggested by Berns, Motta and Gorzinsky (1993). This equation is <PRE> L = (a*(x-b))^g</PRE> <PRE> if a*(x-b) > 0, otherwise L = 0.0. </PRE> The parameters g, a, and b of these functions are defined by the following PXL parameters: redgamma, redgain, redoffset, greengamma, greengain, greenoffset, bluegamma, bluegain, blueoffset. The chromaticity coordinates and the maximum luminance values are derived from the above mentioned color primary parameters.

The color demonstration program cvd.exe contains a demonstration which allows for a visual adjustment of the gamma function and a subsequent estimation of the function parameters. cvd.exe displays the parameter values on the screen and also writes them into its log-file. From there they may easily copied into the file startup.pxl if no other way to estimate the gamma function is available.

Monitor Adjustment

The display quality of a color monitor strongly depends on how the monitor brightness and contrast is adjusted. The brightness control shifts the gamma function as shown in Fig. gammafun in the horizontal direction. The contrast control multiplies the gamma function such that it expands or shrinks in the vertical direction. A good advice for adjusting the monitor is the following:
  1. Set the contrast control to a medium value and then adjust the brightness to the highest value which simultanously keeps black areas as dark as possible.
  2. Set the contrast control as high as possible while keeping a sharp display. Some monitors have a fixed medium position which usually is a good setting to choose.
  3. Carefully check whether a contrast adjustment changes colors. This may be possible if high intensity color patches are displayed and the monitor activates some intensitiy compression mechanism for protecting its tube. This must be avoided. The activation of an output compression function can easily be detected in the gamma function. If such a mechanism is active then the gamma function changes its direction of curvature for high input intensities.
  4. You may use the program cvd.exe with option -b to control the adjustments.
  5. In any case you should set the controls such that the positions may be reproduced easily if someone else changes the adjustments. If you buy one of those new digitally controlled monitors it is a good idea to chose one which is able to display the actual settings of all its controls. Otherwise it is impossible to reproduce fixed settings other than extreme values.

Back to table of contents


Author: Hans Irtel

irtel@psychologie.uni-mannheim.de