Color Processing Toolbox: Colorlab 1.0
J. Malo and Mª José Luque


COLORLAB is a color computation and visualization toolbox to be used in the MATLAB environment. COLORLAB is intended to deal with color in general-purpose quantitative colorimetric applications as color image processing and psychophysical experimentation. 

COLORLAB uses colorimetrically meaningful representations of color and color images (tristimulus values, chromatic coordinates and luminance, or, dominant wavelength, purity and luminance), in any primaries system of the tristimulus colorimetry (including CIE standards as CIE XYZ or CIE RGB). COLORLAB relates this variety of colorimetric representations to the usual device-dependent discrete-color representation, i.e. it solves the problem of displaying a colorimetrically specified scene in the monitor within the accuracy of the VGA. 

A number of other interesting color representations are also provided, as CIE uniform color spaces (as CIE Lab and CIE Luv, opponent color representations based on advanced color vision models, and color appearance representations (RLab, LLab, SVF and CIECAMs). All these representations are invertible, so the result of image processing made in these colorimetrically meaningful representations can always be inverted back to the tristimulus representation at hand, and be displayed. 
COLORLAB includes useful visualization routines to represent colors in the tristimulus space or in the chromatic diagram of any color basis, as well as an advanced vector quantization scheme for color palette design. 
An extensive color data base is also included, with the CIE 1931 color matching functions, reflectance data of 1250 chips from the Munsell Book of Color, McAdam ellipses, normalized spectra of a number of standard CIE illuminants, matrices to change to a number of tristimulus representations, and calibration data of an ordinary CRT monitor. 

Some COLORLAB capabilities (in any tristimulus and many color appearance spaces):
Warning!: the examples below will not be quantitatively correct unless the calibration parameters of your screen match the generic parameters used in the compuations. However, you can also use COLORLAB to calibrate your monitor.

Editing the purity
Color segmentation using dominant wavelength and editing the hue
Editing the luminance
Changing the (user defined or CIE standard) illuminant
Playing with McAdam ellipses and Munsell Chips
Predict non-linear color effects such as induction, adaptation or color constancy

               Editing the Purity:
Colorimetric Purity and Excitation Purity are the descriptors of colorfulness in Tristimulus Colorimetry. Both of them are available in COLORLAB. In the example below we analyze the colors of an image in the CIE XYZ system and reduce the excitation purity by a constant factor leaving the luminace and the dominant wavelength unaltered in order to obtain an image with reduced colorfulness. Other posibilities to obtain this effect with COLORLAB include using any other tristimulus representations or changing the colorfulness descriptors in a number of available non-linear color appearance models.

               Color segmentation (using dominant wavelength) and editing the Hue:

The Dominant Wavelength is the descriptor of hue in Tristimulus Colorimetry. In the example below we first segment the flowers by selecting a range of wavelenghts (in the CIE XYZ chromatic diagram) and then, we modify their hue by applying a rotation to the chromatic coordinates. Other posibilities to obtain this effect with COLORLAB include using any other tristimulus representation or changing (rotating) the hue descriptor in a number of available non-linear color appearance models.

                Editing the Luminance:
The Luminance is the descriptor of brightness in Tristimulus Colorimetry. In the example below we reduce the luminance by reducing the lenght of the tristimulus vectors by a constant factor in an arbitrary (RBG) tristimulus space (note how the chromatic diagram is twisted). Of course the chromatic coordinates remain the same (as can be seen in the figures below). Other posibilities to obtain this effect with COLORLAB include using any other tristimulus representation or changing the brightness descriptor in a number of available non-linear color appearance models.

              Change the Illuminant:
COLORLAB is able to deal with the spectro-radiometric description of color images or estimate it from their (usual) colorimetric description by using the Munsell reflectances data set. In this way, the effect of changing the spectral radiance of the illuminant may be simulated by obtaining the new tristimulus values with the new illuminant. In the example below, each pixel of the original image is assumed to be a patch with a given (or estimated) reflectance under white light illumination. The user may define a different illuminant (in this case a purple radiation) and apply it to the reflectances, thus obtaining the new image and the new (tristimulus) colors. Of course, this can be done in any tristimulus representation. But, better than that, if non-linear color appearance models are used together with the corresponding pair procedure [Capilla04], color constancy may be predicted!.

                    Play with McAdam Ellipses and Munsell Chips:
Now you can easily check the non-uniformity of the tristimulus space in your computer screen! As COLORLAB comes with the McAdam ellipses database and the Munsell chips database, its color reproduction ability allows you to generate the right colors to prove that your discrimination is not Euclidean. 
In the first example below, we distort two given colors (green and blue) in by a constant factor in the chromatic diagram in the principal directions of the ellipsoids. Despite the eventual inaccuracies introduced by the use of a generic calibration, it is clear that blues are more different each other (the ellipse is smaller!) and the distortion in every case is more noticeable when it is done in the short direction of the ellipse. The second example shows a set of Munsell chips of different chroma which are chosen to depart each other a constant number of JNDs.

                Predicting induction effects with Llab:
The perception of a test is modified by the stimuli in the surround. This is referred to as chromatic induction. In the example below, the (physically constant) gray test in the center changes its color to blueish as the surround gets more yellow.
Non-linear color appearance models are required to understand this effect. In the example below the Llab non-linear color representation was used to compute the corresponding colors of the central test in a gray surround. The results are shown in the CIE xy diagram. Note that as the surround increases the colorfulness, an oposite reaction is induced in the test. This numerical result was used to generate a set of different stimuli in a constant gray background giving rise to the same perception as the central test on a changing background (see below).

Related Papers

We have decided to make the library available to the research community free of charge. If you use COLORLAB in your research, we kindly ask that you reference this website:

COLORLAB: a color processing toolbox for Matlab

J. Malo and M.J. Luque,

Download Code

Readme File readme1.txt mat
Installation Files mat
User Guide (ziped *.pdf) mat