Spectrum to RGB Conversion


Spectrum.jpg (20974 bytes) In 1931, the International Commission on Illumination (CIE) defined three standard primaries, called X, Y and Z. The corresponding functions x_bar.jpg (733 bytes), y_bar.jpg (713 bytes), and z_bar.jpg (714 bytes) are called color-matching functions. The y_bar.jpg (713 bytes) color-matching function is defined to match the eye's sensitivity to brightness; the other two do not correlate with any perceptual attibutes. X, Y and Z represent the weights of the respective color-matching functions needed to approximate a particular spectrum.

To match a color with power distribution P, the amounts of  the primaries are given by the following formulae [1]:

primaries.gif (4899 bytes)

where k for self-luminous bodies, such as CRT, is equal to 680 lumens per watt.


To transform from XYZ to RGB (with D65 white point), the matrix transform is used [3]:

   [ R ]   [  3.240479 -1.537150 -0.498535 ]   [ X ]
   [ G ] = [ -0.969256  1.875992  0.041556 ] * [ Y ]
   [ B ]   [  0.055648 -0.204043  1.057311 ]   [ Z ].

The range for valid R, G, B values is [0,1]. Note, this matrix has negative coefficients. Some XYZ color may transform to R, G, B values that are negative or greater than one. This means that not all visible colors can be produced using the RGB system.