From: lilleyc@cs.man.ac.uk (Chris Lilley)
Newsgroups: comp.graphics
Subject: Re: Is there a mathematical relationship RGB -> wavelength?
Date: 14 Aug 92 13:32:23 GMT
Reply-To: lilleyc@cs.man.ac.uk (Chris Lilley)
Organization: Department of Computer Science, University of Manchester UK

In article <1992Aug13.233117.21185@cco.caltech.edu>
nyet@cco.caltech.edu (n liu) writes: 

>dangold1@iastate.edu (Daniel M Goldman) writes:

>>In <92225.171906POLOWINJ@QUCDN.QueensU.CA> Joel Polowin
<POLOWINJ@QUCDN.QueensU.CA> writes: 

>>> > For curiosity's sake, I was wondering if it is possible to take a set
>>> > of RGB color fractions and come up with an approximate wavelength of
>>> > the observed mixture.  [...]

>>    In dealing with real light, we run into metamers, colors which look
>>    the same under one light source, but look like different colors
>>    under a different light source. [...]

>Basically, the three coordinate system was made up since we have 3 mostly
>independent color receptors. 

No, it was made up because matching studies showed that many colours
could be matched with only three lights. All colours can be matched
with any three colours, if you allow them the clever property of
negative contributions.

This does not relate directly to the cones in the retina.

>RGB space manages to cover most (but not all)
>of the color gamut we are able to see. 

Actually , a typical monitor covers less than a third of the colours.
But it covers the most common, less vivid ones.

>Keep in mind that our color sense is
>extremely crude, i.e. we can't tell the difference between pure magenta
>and a spectrum that contains a spike at blue and a spike at red. 

Yes, all colours are seen as a single sensation.

>This is because
>our receptors are stimulated "identically" in both cases. 

Not necessarily. There is a lot of processing going on, and a lot of
psychological effects to consider.

>CIE did a huge survey
>with a bunch of subjects (does this look the same distance in blue to this 
>sample as the distance in blue between these other samples? etc.) and came
>up with 

A set of matching functions for the three lamps they were using (the
amount of each lamp required to match each single-wavelength colour
(down to 1nm bands) throughout the visible spectrum. They transformed
these to another set of imaginary primaries which do not ever have to
be mixed in negative amounts to match any visible colour.

>an average cone response for each of the three cones. 

No, but I see why you said this.

>(foley and van damn has some stuff on this i think). 

Very little, and that not very clear. FvDFH is a great book for c.g
geometry and stuff, but the section on colour is IMHO weak.

>The CIE colorspaces are a very close
>approximation to these responses. 

The CIE colourspace is *exactly* these responses. Given the measured
spectrum of a colour, the matching functions are used to compute the
amount of each CIE primary required to match each band of wavelengths
(by multiplication, ie a weighting scheme).

Adding these amounts over the whole spectrum gives the amount of CIE
primaries to match the given colour. This is the CIE XYZ model,
published in 1931
 
>In any case, you can look up these response
>curves and do a bit of math by superposing the responses to a particular
>wavelength and then convert to RGB (i forget what the standard wavelengths
>are for RGB... 

Pretty close, see above. As you note, colours are indivisible
sensations so by this point the actual wavelengths have become lost.
If you think of it as information reduction - 10nm samples (say) from
380nm to 730 nm is a lot of info, boiled down to just 3 numbers (XYZ).
The wavelength info has been lost by this point.

RGB do not correspond to individual wavelengths. They are not spectral
(monochromatic) colours. Also, each RGB device has *different* colours
of RGB (in some cases, very different. The NTSC monitor is a good
example).

Given a colour in XYZ, and the spec of your monitor, and the gamma, an
XYZ value can be converted to RGB for any desired monitor.


>nyet@cco.caltech.edu
>nyet@aerospace.aero.org


--
Chris Lilley
---------------------------------------------------------------------------
Technical Author, ITTI Computer Graphics and Visualisation Training Project
Computer Graphics Unit, Manchester Computing Centre, Manchester, UK
Internet:   lilley@cgu.mcc.ac.uk        Janet:   lilley@uk.ac.mcc.cgu
Voice:      +44 (0)61 275 6095          Fax:     +44 (0)61 275 6040
---------------------------------------------------------------------------