Accurate Image Manipulation for Desktop Publishing  

CIE_XYZ and CIE_xyY

Some important definitions first

A color profile such like ICC/ICM profile is a set of measurement results that describes the colors of a particular imaging device. It contains:
  1. transfer function of the device.
  2. tri-chromatic coordinates of the device.
  3. the white-point coordinates of the device.
The above fully describes the colors that a digital imaging device use/has and allows accurate color conversion from device to device. 

Transfer function is measured or mathematical function by which the particular device codes the intensities, in the simplest form a single gamma value.

Tri-chromatic coordinates describes the device's color-gamut in the CIE_xyY color-space. 

Color-gamut is a subset of CIE_xyY space, in other words color-gamut describes the variety or range of colors that the device is able to reproduce.

White-point is the description of that hue that is considered to be colorless (gray, achromatic).

Hue is the chromaticity of a color. In other words hue is the luminance normalized color. 

Tristimulus

The eye has three types of color sensitive sensors, red, green and blue. The theory says that any real-life color (real-life colors are composed by a wide spectra of different hues) that we see can be simulated by additive mixture of only three spot colors, red, green and blue, by varying their intensity (or by subtractive mixture of their complementary colors, cyan, magenta and yellow). This is how all the color reproduction works, both digital and chemical.

The above graph illustrates the spectral sensitivity of the human vision according to the CIE 1931 Photopic Standard Observer for color patches with 2 degree visual field.

CIE_XYZ color-space

CIE (Commission Internationale de l'Eclairage) created the CIE_XYZ color-space as early as in 1931. The color vision of a group of people was tested and a model for human visual perception called The CIE Standard Observer was created based on those tests. The CIE_XYZ color-space was then created by combining:
  • the well known physical properties of light and 
  • the characteristics and restrictions/boundaries of the of the human visual perception per the The CIE Standard Observer
In other words the CIE_XYZ color-space 
  • defines the light radiation exactly as it appears in the real-life, 
  • is weighted by the color-matching abilities of the average human eye, 
  • is restricted to the radiation spectrum that is visible for the average human eye, 
  • is a physical axis system that closely simulates the human visual perception.
For the above reasons CIE_XYZ is the fundamental basis of all color management such as calibration, color-space conversions and color matching. It is also the foundation for all other color-spaces.
Common confusions about the CIE_XYZ color-space:
  • Some people claim that the CIE_XYZ  would not be accurate since a relatively small group of people were involved in the testing that the CIE Standard Observer is based on. These people do not acknowledge that the CIE_XYZ is in the first place a mathematical model for the well established behavior of light radiation, in this respect the CIE_XYZ can not be incorrect. Then there is of course some variation between the visual perception of individuals, but for instance we can not see infrared nor ultraviolet light, none of us can't. Also we all weight the luminance similarly, e.g. yellow light appears more light to us than the same physical amount of blue light, for all of us. So, on average CIE_XYZ is a very accurate model for human visual perception.

  •  
  • Some people claim that the CIE_XYZ would not be perceptionally uniform. This claim is, simply, from the outer space. What do they mean by perceptionally uniform color-space? It turn out to be a color space where equal amount of numerical change to the color codes (RGB codes) gives equal amount of change in visual stimuli. 

  •  

     

    But that is not not at all the characteristics of the visual perception. E.g. we are much more sensitive to green light than to blue light. Adding a small amount of blue light to a large amount of green light will not change the perceived hue nor luminance much. But adding the same small amount, but now green light to the same large amount but now blue light will give notable change in both the perceived hue and luminance.

    Hence it is the CIE_XYZ color-space that is perceptionally uniform.

    A color-space where equal numeric amount of change to the color codes gives equal amount of change in visual stimuli is mathematically uniform, not perceptionally uniform. Such color-space may be good for work that depends on chosen colors, such as creating graphics art. But it is very bad for digital photographic imaging that gets the colors from the real-life and has the purpose of enabling error-free digital enhancement and to convey this information for the eye as naturally and error-free as possible.

Chromaticity coordinates and CIE_xyY

    Because both the photopic luminance sensitivity (how light a gray is) and the luminous efficiency (how light a color is) of the eye are linear also the CIE_XYZ is a linear color-space. One of the channels (Y channel) is exactly the same as the luminance and the X and Z channels contains the chromaticity information. 

    Chromaticity coordinates (denoted always with a lower case letter) are Tristimulus values (denoted always with an upper case letter) that are normalized by the luminance:
     

    x = X / ( X + Y+ Z )
    y = Y / ( X + Y+ Z )
    z = Z / ( X + Y+ Z )
    This representation of the CIE_XYZ color-space is called as the CIE_xyY and is the form in which the CIE_XYZ color-space is usually illustrated.

    Due to the luminance normalization:
     

    x + y + z = 1
    so only two values are needed to describe the chromaticity since always:
     
    z = 1 - x - y
    The absolute Tristimulus values can be calculated from the chromaticity values easily when the absolute luminance Y is known:
     
      X = (Y / y) * x
      Z = (Y / y) * ( 1 - x - y ) = (Y / y) * z
Illustration of the CIE_XYZ color space, but in the form of xyY (normalized by luminance). Only a slice (or a cross-section) from the three dimensional space is shown. The luminance (Y) is normal to the diagram.
Since the spectral sensitivity of the human vision varies (we are most sensitive to green) the greenish area in the CIE Chromaticity Diagram, xyY, is the largest.

The chart is just an illustration since the CRT monitor simply can not show all colors that are visible to the eye. The edge of the color-space represents the chromaticity boundary of the visible spectrum. 

By looking at the above slice from the three-dimensional CIE_xyY illustration one could draw a hasty conclusion that  CIE_xyY or the CIE_XYZ do not have a pure black nor pure white at all, but they just reside on two other slices. 

The gray triangle in the chart shows the gamut of the typical CRT monitor with trinitron phosphors. The hue of the three phosphors of the CRT (red, green and blue)  are specified by the x,y coordinates and  the corners of the CRT triangle are set at those x,y locations. So, we can see that a CRT can reproduce only a portion of all the visible hues.

Conversion between CIE_XYZ (or CIE_xyY) and RGB

Conversion between any two tri-chromatic color-spaces is the same as solving a linear matrix equations. The source data must be linear, in other words gamma compensation (or other non-linearity) must be calculated away in order to obtain the natural, linear intensity representation.

For a fully described color-space the chromatic coordinates (of the three primary colors like the red, green and blue phosphors of a CRT) and the white-point coordinates are needed. 

White point is the hue that is considered to be neutral (gray or achromatic) in a color-gamut. In the real-life this is the chromaticity of the illuminant, e.g outdoors that is naturally the same as the sunlight or daylight).

In a self-luminous tri-chomatic color-gamut such as the CRT monitor we are able to change the white-point by linearly scaling the maximum intensity of the red, green and blue guns. Hence the white-point is defined to be be that hue that is shown when all the guns are set to maximum (R=G=B=1, note that the RGB scaling here is 0...1). This also means that luminance (Yn) of the white-point is 1.

On a print the white-point is the hue that the paper white shows under the illuminant that is currently used. Hence it depends on the chromaticity of the paper and the chromaticity of the illuminant.

Like with the primaries the white-point chromaticity coordinate is usually given as the normalized x, y values, often denoted as xn, yn ("n" comes from "neutral"). For the conversion purposes the absolute Tristimulus values are needed. Since the Yn has to be 1 for the white-point we get:

Xn = Yn / yn * xn = xn / yn
Yn = yn / yn = 1
Zn = Yn / yn * zn = zn / yn

Matrix conversion

Since both the RGB and CIE_XYZ are physical descriptions of color the conversion only requires linear scaling of the chromaticities around the white-point and then solving the 3x3 linear equations in order to convert the axis system.
The chromaticity matrix |C| is written as follows:
      |xr xg xb|
|C| = |yr yg yb|
      |zr zg zb|
and the white-point matrix |W| as: 
      |Xn|   |xn / yn|
|W| = |Yn| = |   1   |
      |Zn|   |zn / yn|
In order to define the chromaticities in the RGB axis system (under a given color temperature) so that R=G=B=1 gives the white-point an achromatic correction |A| has to be calculated in such way that:
|W| = |C| X |A|
So we get:
|A| = |C|-1 X |W| 

where:
  - |C|-1 is the inverse matrix of |C|
  - X denotes matrix multiplication

(I leave the calculation of the inverse matrix for the reader, literal expansion is a bit tedious, e.g. Microsoft Excel has it built in).

The result will be a 3x1 matrix:
      |Ar|
|A| = |Ag|
      |Ab|
Now the chromaticity matrix |C| is scaled by the achromatic correction |A| that provides the conversion matrix |M| under the desired white-point:
|M| = |C| * transpose(|A|)

where:
  - * denotes multiplication (in place, not matrix
      multiplication)

In other words:

      |xr*Ar xg*Ag xb*Ab|
|M| = |yr*Ar yg*Ag yb*Ab|
      |zr*Ar zg*Ag zb*Ab|
RGB to CIE_XYZ conversion is finally:
|X|         |R|
|Y| = |M| X |G|
|Z|         |B|

where:
  - X denotes matrix multiplication
  - R, G and B are linear red, green and blue 
    intensities in the range 0...1

Conversion from CIE_XYZ to RGB naturally is:
|R|           |X|
|G| = |M|-1 X |Y|
|B|           |Z|

where:
  - |M|-1 is the inverse matrix of |M|
  - X denotes matrix multiplication 

Notes
When RGB data from one color-space (primaries & color temperature) needs to be converted to another RGB color-space then the original RGB data is converted by |M1| into CIE_XYZ and from there by |M2|-1 into the destination RGB color-space. 

Some of the properties of the |M|:

      |1| 
|M| X |1| = |W|
      |1|

The row sum of the coefficients gives the white-point (same as the above matrix multiplication).

The column sum of the coefficients gives the |A| transposed.

Dividing each of the coefficient by it's own column sum gives the |C|. 

Since the Y row is the same as the luminance it gives the accurate RGB color to gray conversion coefficients.

Built-in Color Profiles of Photoshop 5.0.2

The below table shows the built-in color profiles of Photoshop 5.0.2. It may be useful for comparison purposes. In general CRT monitors have either Trinitron or P22 phosphors and using a larger color-gamut in Photoshop than what the CRT is capable to display simply reduces the quality. Only smaller color-gamuts (such as those of printers) can be simulated properly. 
Working-Space name in Photoshop Phosphors (chromaticity coordinates) White-point Original naming
Working Space Name Primaries White-Point Gamma Compensation x
red
y
red
x
reen
y
g reen
x
blue
y
blue
x
white
y
white

Color-Space
Name

White-Point
Name
Apple RGB Trinitron D65 1.8 0.625 0.34 0.28 0.595 0.155 0.07 0.312713 0.329016 Trinitron D65
SMPTE-C SMPTE-C (CCIR 601-1) D65 2.2 0.63 0.34 0.31 0.595 0.155 0.07 0.312713 0.329016 ? D65
sRGB HDTV D65 2.2 0.64 0.33 0.3 0.6 0.15 0.06 0.312713 0.329016 CCIR 709 D65
Pal/Secam EBU/ITU D65 2.2 0.64 0.33 0.29 0.6 0.15 0.06 0.312713 0.329016 CIE_XYZitu D65
Color Match RGB P22-EBU D50 1.8 0.63 0.34 0.295 0.605 0.155 0.077 0.3457 0.3585 P22-EBU D50
Adobe RGB Adobe RGB (1998) D65 2.2 0.64 0.33 0.21 0.71 0.15 0.06 0.312713 0.329016 Adobe RGB (1998) D65
NTSC (1953) NTSC (1953) Std Illuminant C 2.2 0.67 0.33 0.21 0.71 0.14 0.08 0.310063 0.316158 CCIR 601-1 Std Illuminant C
CIE RGB CIE RGB Std Illuminant E 2.2 0.735 0.265 0.274 0.717 0.167 0.009 0.3333 0.3333 CIE RGB Std Illuminant E
Wide Gamut RGB 700/525/450nm D50 2.2 0.7347 0.2653 0.1152 0.8264 0.1566 0.0177 0.3457 0.3585 ? D50

Some white-point coordinates

White name Provided by xn yn
CIE Std illuminant A Tungsten lamp, normal incandescent 0.4476  0.4074
D5000 or D50  Bright tungsten (low voltage bulb at serious overvoltage) 0.3457  0.3585
CIE Std illuminant B Direct sunlight 0.3484  0.3516
D5500 or D55 Cloudy daylight 0.3324  0.3474
CIE Std illuminant E Normalized reference source 1/3 1/3
D6500 or D65  Daylight 0.312713 0.329016
CIE Std illuminant C Average Sunlight 0.3101 0.3162
D7500 or D75 ? 0.299 0.3149
D9300 Default of some old or low-quality CRT monitors, very bad for imaging. 0.2848 0.2932

White-point

Here is a large tabulated list for Correlated Color Temperature to CIE_x, CIE_y (filesize 714kB) from 1000K to 25000 by 1 degree step.

 


Accurate Image Manipulation for Desktop Publishing  

Copyright Timo Autiokari, 1998-2007. Contact info