0

I wonder how to make a 1-to-1 mapping between the 3D RGB color-space and 1D visible light wavelength (nanometers)? I have shown their images below:

enter image description here

enter image description here

I mean if I want to know what is the RGB color that is equivalent to 450 nm wavelength on spectrum or 550 nm or 600 nm then how would I do that calculation? Similarly if I have a color in 8-bit RGB space for example (10, 100, 200) then what wavelength it corresponds to on the visible spectrum?

Copied from a comment after one answer

My actual goal is to test optical filters. These materials have cutoff wavelengths let us say a specific material has cutoff wavelength as 630 nm. So all wavelengths above this will not pass through it. If I want to generate that color on my RGB screen that approximately corresponds to 630 nm wavelength then I could see if my optical filter stops that color to pass through it or not.

Any approximate look-up table can work for me as I know its not an exact mapping.

1

TL;DR Wavelength != Color

You can not since there is no one to one mapping. What you see on a monitor is three bumps on the spectral distribition. There is no color that your monitor displays that matches any of the wavelengths, only approximate to approximate conversion is possible even so many colors dont match anything.

enter image description here

The above plot shows relation to human vision and spectrum, the outermost edge is a pure spectral color. While the triangle is the sRGB gamut. As you see there is no point inside the triangle that is on the edge of the outermost edge.

More thorough explanation

Your under the assumption that color and wavelength is somehow the same thing. This is a common misconception. You have extrapolated a very simple explanation of how a rainbow is created from a prism. The exact incorrect conclusion that this is also true in reverse, its not! Its only one possible reverse out of untold combinations.

So following applies

  • TRUE statement (meaninfully big) Change in a wavelength always changes perceived color.

But the reverse is not generally true:

  • Following is FALSE (meaninfully big) Change in perceived color alway means change in wavelength

Why?

The light that you see around you is not composed of one wavelength, its composed of multiple wavelengths. Secondly our eyes don't see wavelengths. They build a signal out of a distribution of wavelengths.

Simply different wavelengths are lumped together into a 3 signal source. THere is no way of knowing what the original wavelength was. Because:

  1. It was not one wavelength to begin with
  2. Any number of different wavelength distributions can, and do make the same color. See wikipedia on metamerism
  3. Bulk of the colors we see are impossible colors in a rainbow.

So as a result our imaging applications don't record the wavelength data because that would explode our memory consumption its also dis interesting. So you can not say what wavelength is in a image if you put a filter that removes all wavelengths above some threshold. Since you don't know what wavelengths the image had in first place.

This is good, otherwise your monitor wouldnt work.

There exist cameras that can do this, they have special formats. But you don't have a camera that does, nor do you have any pictures on your computer that do, nor do you have a application on your computer that can even manage to display such pictures. Because such tools are rare and expensive indeed.

  • What can be a very crude approximate conversion between RGB and wavelength? Is there any mapping (equation) that can help to do this conversion? – scico111 Oct 19 '20 at 14:29
  • If there is no 1-to-1 mapping then does it mean that one wavelength can correspond to more than one RGB colors and one RGB color can correspond to more than one color wavelengths? – scico111 Oct 19 '20 at 14:31
  • Is it possible to get any Look-up-table for doing this conversion? – scico111 Oct 19 '20 at 14:47
  • @scico111 only possible to answer these if i know what your aim is. To make an aproximation requires me to know what to approximate. There is no 1 to 1 mapping because each monitor color is a combination of multiple wavelenghts. It is like what color of hat does the passenger of the bus have, by totally neglecting the fact that a hat can have multiple colors and a bus has multiple passengers. – joojaa Oct 19 '20 at 15:01
  • I want to do testing of optical filters.. these materials have cutoff wavelengths let us say a specific material has cutoff wavelength as 630 nm. So all wavelengths above this will not pass through it. If I want to generate that color on my RGB screen that approximately corresponds to 630 nm wavelength then I could see if my optical filter stops that color to pass through it or not. Any approximate LUT can work for me as I know its not an exact mapping. – scico111 Oct 21 '20 at 9:32
1

The questioner has done a major mistake. He thought that a color is equivalent with a wavelength. It's not. Color is an experience that a person has when the light sensitive cells of his eye get some light. Usually people have three type of light sensor cells which are most sensitive at three different wavelengths.

All three sensor cell types generate some nerve electricity at all visible wavelengths. So, it's well possible that the same combination of the three nerve stimulations is got with infinite many different light spectral distributions.

For example we can have pure yellow single wavelength 589 nanometer Sodium (=Na, Natrium) light. It's actually out of the range of RGB displays but if you mix with it a little white (=all visible wavelengths together) you can generate a bright yellow which is possible also in RGB.

But RGB display has nothing with wavelength even near the Na yellow. You still can make bright yellow by having R and G channels ON in the display.

enter image description here

(a full white image, the blue channel is closed)

Red and green together stimulate eye cells nearly in the same way as Na light alone.

That makes RGB displays able to create a good part of possible impressions of color by sending a combination of three single wavelength or at least narrow bandwidth light.

It's no use to test light filters with RGB screen colors, you need a method to generate much more than three fixed wavelengths to see how much a filter attenuates at a given wavelength. With RGB you can get the attenuation only at those three wavelenghts that an RGB screen produce.

One way to create such variable wavelength light is to split sunlight or the light of an incandescent light bulb with a prism to a spectrum (like the rainbow) and check what range of the spectrum can be seen through the filter. Making comparisons it can even be measured how much different wavelengths are attenuated (no photoelectric equipment was in use when scientists learned to make on comparison based measurements with early photometers)

Many light sources such as fluorescent lamps and leds (and RGB screens) have gaps in their spectrum and that makes them useless. Only daylight and incandescent bulbs can be considered to have accurately continuous spectrum when only easily available light sources are taken into the account.

  • Yes, i agree. But it is one of a very common misconceptions regarding color. Its typical to people who have done some but not enough science – joojaa Oct 21 '20 at 19:40
  • Though I was under the impression that the natrium light particularily is in area where you cant replicate the sensation except just with that single dirac function. So if im not mistaken that particular example is invalid. Lots of other colors though. I could verify this by integrating against the standard observer but im not that interested – joojaa Oct 21 '20 at 19:42
  • @joojaa You are right. I made the same error as the questioner. It's fixed. – user287001 Oct 21 '20 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.