[vslist] Results of dominant wavelength/excitation purity help request

Jesus Malo Jesus.Malo at uv.es
Wed Nov 17 08:50:00 GMT 2004

Our answer to the dominant wavelength problem is much simpler than 
those I read in the list:

   Please just use coor2lp.m in COLORLAB: 
   A free easy-to-use and comprehensive color processing toolbox 
   for Matlab 5.X or higher!.

   You can dowload it from the software icon in:


   You can also download a complete user guide for your convenience!

In fact, coor2lp.m applies some of the ideas posted by different people 
in the list but in a more general way, i.e. in *any* tristimulus space,
not just CIE XYZ!

Here you have a brief description of what COLORLAB is
(visit the web page above for more details):

COLORLAB is a high-performance 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. COLORLAB relates 
these 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 

A number of interesting color representations are also provided, as CIE 
uniform color spaces (as L*a*b* and L*u*v*), 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.  

This Toolbox was developed by Jesús Malo and Mª José Luque from the Vision 
Science Group of the Dept.of Optics, at the School of Physics, Universitat de 
València (Spain). The current educational and research interests of this group 
include different aspects of color science such as color image compression, 
numerical models of human color vision. 

> The following is a Mathematica routine I wrote some years ago. The 
> code is no doubt incomprehensible, but the idea is simple. First, 
> from a table of the spectrum locus defined by {x,y} chromaticity 
> coordinates vs wavelength, create an interpolating function that 
> returns {x,y} for an arbitrary wavelength. Then find the angle of the 
> line between the white point and the point in question. Then, find 
> the point along the spectrum locus for which the line from the white 
> point has (nearly) the same angle.
> The bit at the end generates a plot of the situation. I attach an 
> example below.
> The code for Excitation purity follows in a straightforward way.
> DominantWavelength[xy_, xyw_:{0.33, 0.33}, 
> chromaticity_:CIE1931Chromaticity, plot_:False] :=
>      Module[{sign = 1, LambdaToxy, x, angle, AngleFromWhite, 
> PositiveAngle, dw, xyl},
>      LambdaToxy[lambda_] := (#[lambda] &) /@ 
> (WaveTableInterpolation[chromaticity][[{1, 2}]]);
>      AngleFromWhite[xy0_] := ArcTan @@ (xy0 - xyw);
>      PositiveAngle[xy1_] :=
>        If[# < 0, # + 2 \[Pi], #, #] &[AngleFromWhite[xy1] - 
> AngleFromWhite[LambdaToxy[700]]];
>      angle = PositiveAngle[xy];
>      If[angle > PositiveAngle[LambdaToxy[400]], (angle = angle - Pi; 
> sign = -1)];
>      dw = (FindRoot[angle - PositiveAngle[LambdaToxy[lambda]] == 0, 
> {lambda, 500, 400,700}][[1, 2]]) ;
>          If[plot, xyl = LambdaToxy[dw];
>       	ChromaticityDiagram[NMLabels -> {400, 500, 560, 700}
>         	, Epilog -> {RGBColor @@ NearestRGB[dw, xyw],
>            	Line[{xy, xyw}], Line[{xyl, xyw}], PointSize[.04], 
> GrayLevel[.6],
>            	Point[xyw], Point[xyl], GrayLevel[0], Point[xy]}]];
>      dw sign   ]
> ExcitationPurity[xy_, xyw_:{.33,.33}, chromaticity_:CIE1931Chromaticity] :=
>   If[xy == xyw, 0, Divide @@ ((First /@
>     {xy, WaveTableValue[chromaticity,
>     DominantWavelength[xy,xyw,chromaticity]]}) - xyw[[1]])]
> Here we evaluate an example, with plot.
> DominantWavelength[{.3, .5},{.33,.33}, CIE1931Chromaticity,True]
> -- 
> Andrew B. Watson
> MS 262-2
> NASA Ames Research Center
> Moffett Field, CA 94035-1000
> (650) 604-5419	(650) 604-0255 fax
> andrew.b.watson at nasa.gov	http://vision.arc.nasa.gov/

Zapatero = Kerry, PSOE = Democrats,
i.e. not necessarily good either!

Jesus Malo, PhD in Physics

Associate Prof. at Dept. d'Optica,
Facultat de Fisica, Universitat de Valencia
Dr. Moliner 50, 46100 Burjassot, Valencia,

e-mail: jesus.malo at uv.es
www:    http://www.uv.es/vista/vistavalencia
tel office:   (34) 963 544 717
tel lab:      (34) 963 543 095
fax:          (34) 963 544 715

More information about the visionlist mailing list