[vslist] Results of dominant wavelength/excitation purity help request
Dr. Scott Steinman
steinman@sco.edu
Tue Nov 16 12:20:01 2004
I'd like to thank all those who helped me with mathematical information=20=
(and in some cases, sample code) for calculating the dominant=20
wavelength and excitation purity of a color sample. As a service to=20
other members of CVNet, I'm posting this information here. Please also=20=
see my note at the end of this message.
=46rom Hoover Chan:
My guess is to do a curve fit to the CIE spectral locus and solve the=20
simultaneous equations that result. By the nature of this approach,=20
it'll have to be an approximation but at least it would have an=20
analytic solution.
=46rom Jeff Mulligan, NASA:
Here is what I would do: for any wavelength, you can compute its x,y=20
coordinates on the spectrum locus. Together with the white point, it=20
defines a line in the chromaticity diagram. You can compute the=20
distance from the point in question to this line. Use your favorite=20
optimization routine to vary lambda to minimize this distance. Of=20
course, there will often be two solutions, the correct one is the one=20
where the point in question falls between the spectrum point and the=20
white point.
=46rom R. Tudela, University of Barcelona:
In relation to your question "How do you calculate the dominant=20
wavelength and excitation purity?" The answer is the following:
We start with a table with "n" values of the coordinates for each=20
wavelength. These coordinates will be x[i], y[i] and the wavelength=20
lambda[i], where i=3D1 for the red and i=3Dn for the blue. Xc,yc will be=20=
the coordinates of the problem colour. We transform these coordinates=20
into polar coordinates centred in the E illuminant. Each value of=20
lambda[i] gives an angle alpha[i] =3D atan ((y[i] - 0.333) /(x[i] -=20
0.333)) And the same for the problem colour, alphac =3D atan ((yc -=20
0.333)/(xc - 0.333)) If alphac is between alpha[1] and alpha[n] we find=20=
the value of i which makes alphac to be between alpha[i] and=20
alpha[i+1]. The dominant wavelength of the problem colour will be the=20
interpolated value between lambda[i] and lambda[i+1]. And the=20
coordinates of the problem colour are interpolated in a similar way.=20
Then the excitation purity is the quotient between the distances to the=20=
polar origin (point E) of the problem colour and the distance of the=20
interpolated wavelength. These distances are calculated by doing the=20
operation sqrt ((y - 0.333) * (y - 0.333) + (x - 0.333) * (x - 0.333))=20=
When alphac is not in the range of the pure wavelengths (Magenta zone),=20=
we rest pi radians to the angle and do the same as for the dominant=20
wavelength. To calculate the excitation purity we do the quotient=20
between its distance to the point E and the distance to the origin of=20
the intersection of the line of the angle alphac with the line that=20
joins the points (x[1],y[1]) and (x[n],y[n]).
=46rom J=E1nos Schanda:
The method ... is the following: it defines a straight line using the=20
co-ordinates of the source and the test sample chromaticity=20
co-ordinates, checks whether the test is purple or not, and then uses=20
the chromaticity coordinates of the monochromatic stimuli and seeks the=20=
crossing point between the line defined first and the spectral locus or=20=
purple line. There is a little trickiness at the wavelength when the=20
dominant wavelength line is just perpendicular. But it is not so=20
difficult to figure it out how to handle it. A student of mine recently=20=
wrote it also for an Exel sheet, but I do not have the sheet at hand.
=46rom Osvaldo da Pos:
I made an Excel page to make the calculations of the excitation purity,=20=
but one needs anyway to input some data derived from looking at the CIE=20=
chromaticity diagram. I would be interested in knowing whether anybody=20=
made a better procedure.
=46rom Jim Fulton, Director of Research, VISION CONCEPTS:
Your fundamental problem is the CIE (1931) diagram is not conformal (or=20=
even orthogonal). Your equations would need to be written to=20
accommodate this fact. A better approach would be to convert your x, y=20=
values to u, v or u',v' values. The unprimed values are associated=20
with the CIE(1960) uniform color-scale system (UCS). The primed values=20=
are associated with the newer CIE(1976) uniform color-scale system=20
(UCS). Both of these are empirical estimates of the performance of the=20=
human eye expressed in a nearly linear and orthogonal coordinate space.=20=
See Wyszecki & Stiles (1982) sections 3.3.9 and 6.4.
Your more fundamental problem is that the CIE diagrams are all based on=20=
an additive color theory of vision. In fact, electrophysiology shows=20
that luminance (achromatic ) vision is based on the summation of the=20
natural LOGARITHMS of the spectral sensations generated in the retina. =20=
The exponent of 1/3 found in the formulas of the UCS conversion from=20
the CIE (1931)
diagram is an approximation to the natural logarithm of the same ratios.
Physiologically, the chrominance information is processed in three (two=20=
in a simplified analysis omitting the deep blue and purples) DIFFERENCE=20=
channels. The CIE approach does not utilize any difference signals.
These points are developed in Section 9.1.3 of my short published book,=20=
Biological Vision: A 21st Century Tutorial. The particulars concerning=20=
the book are given following my signature block.
They are also discussed more broadly in my manuscript from which the=20
book was drawn. The part of interest to you is Section 17.3.5 in=20
www.4colorvision.com/pdf/17Performance1b.htm In particular, Figure=20
17.3.5-6 highlights the lack of conformalism in the CIE (1931)=20
diagrams. The straight lines deviate significantly from the isoclines=20
of physiological vision. A set of linear equations can only be used to=20=
represent the core of the diagram, for excitation purities of less than=20=
about 20%.
www.4colorvision.com/files/colorabnormal.htm illustrates these=20
deviations in color as best as one can on a low quality medium like the=20=
internet. The figures on that page separate the colors based on=20
physiology.
The CIE UCS diagrams are much better and approach conformality. In=20
briefer form, you might want to look at=20
www.4colorvision.com/files/perform.htm It contains several calls of=20
interest.
If you were willing to use a lookup table to convert x,y into Munsell=20
space (the tables are available in the back of Wyszecki & Stiles, 1982)=20=
and then do your calculations in that space (which is conformal)=20
followed by translating back to x,y space, you would get the correct=20
answer within a few percent for any purity and dominant wavelength=20
(following the isoclines discussed earlier).
However, Munsell space requires a knowledge of the luminance intensity=20=
in order to define the maximum purity. The CIE diagrams, other than=20
LAB & LUV do not contain a luminance level or require a nominal=20
luminance level. While in Munsell space, you could also determine the=20
two wavelengths required to generate the match. The match would be=20
confirmable by the human observer. These wavelengths would correspond=20=
roughly to the values in Hering Space. The theoretical colors in=20
Hering space are violet-yellow and cyan- (Hering) red. Not blue-yellow=20=
and green-red.
I appreciate the level of understanding you are trying to teach. =20
However, if you find a really inquisitive student, please steer him to=20=
my site. It will take years before the old CIE diagrams are dropped=20
from textbooks.
My additional notes:
The calculations were used for a simple program to demonstrate color=20
definition by RGB or hue, saturation and brightness, color mixing, and=20=
complementary colors. The program was used in my classroom to=20
demonstrate these concepts interactively on the CIE diagram. The=20
calculations were therefore kept simple and only approximate for the=20
sake of program speed so interactivity wouldn't be compromised. I am=20
open-sourcing this program and making it available at no cost to the=20
optometry and vision science community. It presently runs on Mac OS X=20
only, but I am considering a Windows version too since the only=20
Mac-specific feature is the use of ColorSync to retrieve the LCD=20
monitor gamut. The compiled program can be found at:
http://homepage.mac.com/drsteinman/. Source code can be obtained from=20
me by emailing me at the address below.
Regards,
Scott
Scott B. Steinman, O.D., Ph.D., F.A.A.O.
Professor, Southern College of Optometry
Co-Chair, ASCO Informatics SIG
Chair, Open Source Purely-Graphical Programming Language Initiative=20
(www.ospgli.org)
Author, "Visual Programming with Prograph CPX", Manning/Prentice-Hall,=20=
1995 (www.manning.com/steinman).
Author, "Foundations of Binocular Vision", McGraw-Hill, 2000=20
(books.mcgraw-hill.com/cgi-bin/pbg/0838526705.html)
Certified non-Microsoft Solutions Provider
1245 Madison Avenue
Memphis, TN 38104-2222
steinman at sco.edu
For every complex problem there is an answer that is clear, simple, and=20=
wrong. -- H L Mencken
I hope I die peacefully in my sleep like my grandfather. . .not=20
screaming in terror like his passengers. -- Anonymous=