Main Content

Device-Independent Color Spaces

The standard terms used to describe colors, such as hue, brightness, and intensity, are subjective and make comparisons difficult.

In 1931, the International Commission on Illumination, known by the acronym CIE, for Commission Internationale de l'Éclairage, studied human color perception and developed a standard, called the CIE XYZ. This standard defined a three-dimensional space where three values, called tristimulus values, define a color. This standard is still widely used today.

In the decades since that initial specification, the CIE has developed several additional color space specifications that attempt to provide alternative color representations that are better suited to some purposes than XYZ. For example, in 1976, in an effort to get a perceptually uniform color space that could be correlated with the visual appearance of colors, the CIE created the L*a*b* color space.

Convert Between Device-Independent Color Spaces

Image Processing Toolbox™ supports conversions between members of the CIE family of device-independent color spaces. In addition, the toolbox also supports conversions between these CIE color spaces and the sRGB color space. This color space was defined by an industry group to describe the characteristics of a typical PC monitor.

This table lists all the device-independent color spaces that the toolbox supports.

Color Space

Description

Supported Conversions

XYZ

The original, 1931 CIE color space specification.

xyY, uvl, u′v′L, and L*a*b*

xyY

CIE specification that provides normalized chromaticity values. The capital Y value represents luminance and is the same as in XYZ.

XYZ

uvL

CIE specification that attempts to make the chromaticity plane more visually uniform. L is luminance and is the same as Y in XYZ.

XYZ

u′v′L

CIE specification in which u and v are rescaled to improve uniformity.

XYZ

L*a*b*

CIE specification that attempts to make the luminance scale more perceptually uniform. L* is a nonlinear scaling of L, normalized to a reference white point.

XYZ

L*ch

CIE specification where c is chroma and h is hue. These values are a polar coordinate conversion of a* and b* in L*a*b*.

L*a*b*

sRGB

Standard adopted by major manufacturers that characterizes the average PC monitor.

XYZ and L*a*b*

Color Space Data Encodings

When you convert between two device-independent color spaces, the data type used to encode the color data can sometimes change, depending on what encodings the color spaces support. In the preceding example, the original image is uint8 data. The XYZ conversion is uint16 data. The XYZ color space does not define a uint8 encoding. The following table lists the data types that can be used to represent values in all the device-independent color spaces.

Color Space

Encodings

XYZ

uint16 or double

xyY

double

uvL

double

u'v'L

double

L*a*b*

uint8, uint16, or double

L*ch

double

RGB

double uint8 uint16

As the table indicates, certain color spaces have data type limitations. For example, the XYZ color space does not define a uint8 encoding. If you convert 8-bit CIE LAB data into the XYZ color space, the data is returned in uint16 format. To change the encoding of XYZ data, use these functions:

  • xyz2double

  • xyz2uint16

To change the encoding of L*a*b* data, use these functions:

  • lab2double

  • lab2uint8

  • lab2uint16

To change the encoding of RGB data, use these functions:

  • im2double

  • im2uint8

  • im2uint16