RGB and wavelengths in the visible spectrum.

RGB and wavelengths in the visible spectrum.

Post by Tim » Fri, 05 Jul 2002 16:38:28



How do you convert an RGB value into its wavelength in the visible
spectrum?  For example let say you have the RGB value 0x43FDA2 and its
wavelength is 568 nm (not the correct value).  Is there a formula that
will convert the 0x43FDA2 to 568 nm? And how about the reverse:  568 nm
to RGB's 0x43FDA2?
 
 
 

RGB and wavelengths in the visible spectrum.

Post by Will » Fri, 05 Jul 2002 22:26:38



>How do you convert an RGB value into its wavelength in the visible
>spectrum?  For example let say you have the RGB value 0x43FDA2 and its
>wavelength is 568 nm (not the correct value).  Is there a formula that
>will convert the 0x43FDA2 to 568 nm? And how about the reverse:  568 nm
>to RGB's 0x43FDA2?

RGB colors don't really converge to a single wavelength, just different
intensities of the red, green, and blue wavelengths. 0xFFFFFF is white,
which doesn't have a specific wavelength; real white is all wavelengths
at once. RGB simulates this well only because the color receptors in our
eyes peak at red, green, and blue. We see monochromatic light with a
wavelength between red and green as yellow because it activates both the
red and green receptors, so a combination of monochromatic red and green
looks the same as yellow to us.

To answer your question more practially, I suppose you could do a
weighted average of the wavelengths of two of red, green, or blue, if
only those two are used in the color, but you're stuck if all three
components are used, since that can't look like monochromatic light to us.

I hope this helps.

-- Will
Seeing is believing; You wouldn't have seen it if you didn't believe it.

 
 
 

RGB and wavelengths in the visible spectrum.

Post by Mike William » Sat, 06 Jul 2002 03:42:34



Quote:>How do you convert an RGB value into its wavelength in the visible
>spectrum?  For example let say you have the RGB value 0x43FDA2 and its
>wavelength is 568 nm (not the correct value).  Is there a formula that
>will convert the 0x43FDA2 to 568 nm? And how about the reverse:  568 nm
>to RGB's 0x43FDA2?

Going from RGB to wavelength doesn't work. Not all RGB colours
correspond to monochromatic light. Some RGB colours correspond to two or
more monochromatic lights in more than one way. For example xFFFF00
might be a monochromatic yellow light, or it might be a combination of
some red light and some green light, or a combination of orange and
greeny-yellow etc. xFFFFFF might correspond to roughly equal intensity
across the whole spectrum (like sunlight) or it might correspond to a
fairly small number of narrow emission lines (like fluorescent tubes).

To go from wavelength to RGB you need to get hold of a graph of the
response curves of the three visual pigments. Such a graph shows how
sensitive the visual receptors are to light of varying wavelengths. Each
of the three curves is roughly "bell shaped". The curve for the green
receptor peaks for a wavelength that corresponds to primary green light,
and tails off on both sides as that receptor is less sensitive to yellow
or cyan light.

Once you've got the graph, you simply find the wavelength you're
interested in along the bottom of the graph and read off the height of
the response curves for the three visual pigments. You can scale the
results however you see fit, since knowing only the wavelength of the
light doesn't tell you the brightness - xFFFF00 and x010100 correspond
to the same wavelength. A reasonable strategy would be to scale up the R
G and B components until (at least) one of them was FF.

--
Mike Williams
Gentleman of Leisure

 
 
 

RGB and wavelengths in the visible spectrum.

Post by Ken » Sun, 07 Jul 2002 14:00:47




> >How do you convert an RGB value into its wavelength in the visible
> >spectrum?  For example let say you have the RGB value 0x43FDA2 and its
> >wavelength is 568 nm (not the correct value).  Is there a formula that
> >will convert the 0x43FDA2 to 568 nm? And how about the reverse:  568 nm
> >to RGB's 0x43FDA2?

> RGB colors don't really converge to a single wavelength, just different
> intensities of the red, green, and blue wavelengths. 0xFFFFFF is white,
> which doesn't have a specific wavelength; real white is all wavelengths
> at once. RGB simulates this well only because the color receptors in our
> eyes peak at red, green, and blue. We see monochromatic light with a
> wavelength between red and green as yellow because it activates both the
> red and green receptors, so a combination of monochromatic red and green
> looks the same as yellow to us.

> To answer your question more practially, I suppose you could do a
> weighted average of the wavelengths of two of red, green, or blue, if
> only those two are used in the color, but you're stuck if all three
> components are used, since that can't look like monochromatic light to us.

> I hope this helps.

Something of interest on this topic -
http://www.geo.fmi.fi/~tmakinen/kw_rgb.shtml

--
Ken Tyler

 
 
 

1. Generate RGB spectrum from wavelength

Hello to all,
Can anyone furnish an algorithm and/or source code to generate 0-255 RGB
values that generate a realistic visual spectral color for a given
wavelength in microns over the 0.4-0.7 micron range?  I developed a very
simple 5-band linear model but do not care for its appearance.


Thanks much for any responses,
Mike

2. Import IGES files to Lightwave

3. Visible spectrum and RGB color

4. Convert POV to ????

5. Non-visible wavelength raytracing - HELP!

6. 3DStudio fonts

7. Colormapping the real visible spectrum

8. BML Beta: Come and get it!

9. Help needed!: visible color spectrum..

10. How to draw visible light spectrum with WavelengthToRGB function

11. Colour of Light: wavelength->RGB