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