RGB -> (wavelength, intensity)

Discussion in 'Digital Photography' started by Yeppers, Nov 26, 2006.

  1. Yeppers

    Yeppers Guest

    Hi all,

    Is there a simple straightforward set of equations
    for converting normal visible light
    * red
    * green
    * blue
    values from my digital camear valuesto
    * wavelength
    * intensity

    Second question: how about if I put a IR-pass visible-block filter
    such as the Hoya R72 on my digital camera? Can I compute
    infrared wavelength and intensity from remaining RGB data?

    Yeppers, Nov 26, 2006
    1. Advertisements

  2. No. Too simplistic a model. What's the wavelenght of
    white? Or gray, or black?

    Not all visible colors (or RGB combinations) correspond
    to a specific wavelength. In the general case, the
    perception of color depends on the a spectrum of
    illumination (eg., skylight) multiplied by a spectrum of
    absorption (eg. the pigments of a leaf) selectively
    absorbing portions of the illuminant.

    To get really technical, there's no "pure" RGB color
    space -- you'd have to specify which one.

    rafe b
    Raphael Bustin, Nov 26, 2006
    1. Advertisements

  3. Yeppers

    Ray Fischer Guest

    Yes. You want to convert from the RGB to the HLV color space. That
    will isolate the color from the luminance and the saturation. Mapping
    the color to a wavelength is a straightforward process.

    This will tell you more than you want to know.
    Ray Fischer, Nov 26, 2006
  4. The answer is probably yes and no, though no in reality. Let me explain.
    The RGB filters used in a digital camera have pretty broad spectral
    coverage (see the Kodak graph in one of my IR articles:
    <http://www.dimagemaker.com/article.php?articleID=466>). What this means
    is that the RGB values represent the light intensity over a pretty broad
    part of the spectrum. What this means is that, in reality, you cannot
    convert this into exact wavelength and intensity values.

    However, you could produce a 'simulated' wavelength value by using some
    maths but it would not, IMHO, be meaningful in any real way.

    Same goes for the R72. See my above mentioned article for how IR
    sensitivity works, but the same issue applies. The filter are fairly
    broad in their coverage, so you can't pin something down to a particular


    Wayne J. Cosshall, Nov 26, 2006
  5. However, that is merely a conversion of the output data and bears almost
    no relationship at all to the wavelengths and intensity of the source:
    the original scene spectral content.

    Say, for example, the green pixels in your camera respond from 500nm to
    600nm. Wherever the source spectrum lies in that range you still get
    the same output. An almost pure green light at 550nm, or a light at
    525nm or even a broad spectrum between 475 and 525 would give the same
    RGB output from the camera.

    The camera convolves the source spectral content with its own filter
    bandwidths before the signal is sampled by the sensor. Consequently
    there is no way to get back from the spectral content (wavelength &
    intensity for each pixel) with any more accuracy than the filter
    bandwidths themselves.

    The error in the original question is the assumption that the original
    light can be uniquely defined by a set of red, green and blue values, it
    can't. Even worse, those red green and blue values will only produce a
    certain range of wavelengths and intensity if they are input to a
    display with a particular spectral output of each of the red green and
    blue channels. In most cases the rgb output is merely an approximation
    achieved by calibration, but doesn't need to be any better because
    another spectral convolution occurs in your eye.
    Kennedy McEwen, Nov 26, 2006
  6. Yeppers

    AES Guest

    And this leads to an accidental experimental confirmation of your
    statement that I once encountered.

    The graph on your page shows that the green and blue filters actually
    "turn on" again (and the red filter stays on, and the underlying sensor
    retains some sensitivity) as you move beyond the visible, well out into
    the near IR.

    As a result, sending 1.06 micron YAG laser radiation into a digital
    camera produces a bright *purple* image, at least in the digital camera
    I was involved with -- and it's not due to any harmonic generation.
    AES, Nov 26, 2006
  7. Yeppers

    Ray Fischer Guest

    True enough. Finding the original scene's spectral content is not
    possible without a spectrograph. You need more than just three
    different color sensors.

    What the RGB->HLV conversion will do is give you an approximation of a
    single wavelength that will approximate the perception of the color of
    the original scene.
    Ray Fischer, Nov 26, 2006
  8. Yup, and it is that rise in transmission that allows IR photography with
    digital cameras, providing the separate IR blocking filter is not too


    Wayne J. Cosshall, Nov 26, 2006
  9. Whether or not that colour in the original scene was produced by a
    single wavelength or not.
    Kennedy McEwen, Nov 26, 2006
  10. Yeppers

    Skywise Guest

    In addition to the answer posted by others, I'd like to direct
    you to the following page,


    You should read up on concepts such as "color space" and "color

    Many years ago I spent considerable time on this problem. I
    eventually emperically derived an approximation curve by
    comparing the spectrum of the sun off a grating to views on
    the monitor. The result was used for a chart of laser lines.

    You can see it here,


    Look for the "Visible Laser Spectrum Chart".

    Skywise, Nov 27, 2006
  11. Yeppers

    Ioannis Guest


    The HeNe spectrum is outstanding. I'd be interested to know what kind of setup
    did you use to achieve such resolution and photo accuracy. Can you perhaps
    replicate it here using some ASCII art?

    Ioannis, Nov 27, 2006
  12. Yeppers

    Skywise Guest

    top down view (not to scale)

    _______ grating
    _[ ]_\
    |_____| \
    camera \
    () laser

    Thanks for the compliment. That was really fun to do.

    First, I have several HeNe lasers. I took one of my larger tubes
    out of it's casing and stood it vertically on a wooden chair.

    Yep. I'm high tech. :)

    I have this old beat up reflective diffraction grating that I
    bought at a military surplus many years ago.

    I set up my digital camera to look at the grating at the diffracted
    image of the HeNe bore. The camera was set as close to the grating
    as possible without physically blocking the incoming light.

    I zoomed the camera all the way out and started snapping pictures
    at the highest resolution. I think I needed 3 or 4 images to cover
    the whole spectrum. I had to do several test shots to get the
    exposure settings right. I wanted to 'go deep' without saturating
    the brighter lines and over exposing the background noise caused
    by the poor condition of the grating.

    Then I stitched it all together in software.

    Figuring out all the emission lines was done by referencing some
    data I downloaded for elemental emission spectra and the Handbook
    of Lasers.

    Skywise, Nov 27, 2006
  13. Yeppers

    Ioannis Guest

    Your diagram looks like it doesn't use any slit. How did you collimate the
    laser beam into nice vertical lines without a slit?
    Ioannis, Nov 27, 2006

  14. No, there is no simple set of equations. The problem is that the
    filter responses for the red, green, and blue filters may not have
    easily mathematically describable passbands. The response curve for
    each is likely to be a very complex equation, either a power series
    with many coefficients or some other type of curve fitting equation.
    Same problem. The IR bandpass filter is unlikely to have a simple
    equation, although some of them can be modeled by a sin(x)/x or a
    normal curve equation with sigma representing the passband. So this
    problem is likely to be easier than the original one. However, you
    need to solve the original one before you can do the second.
    Don Stauffer in Minnesota, Nov 27, 2006
  15. Yeppers

    Skywise Guest

    Didn't need one since the laser bore was already a narrow line.
    The further from the camera the laser is, the narrower the 'line'
    of the bore appears.

    The distance I used was about 5 feet.

    Skywise, Nov 27, 2006
  16. Yeppers


    Sep 19, 2012
    Likes Received:
    TomasMarny, Sep 19, 2012
  17. Yeppers


    Mar 26, 2019
    Likes Received:
    Hi all,
    I have RGB values of high intensity more than 255. How to find a wavelength using RGB values and also plot the CIE plot?
    i am upload file of RGB values.

    Attached Files:

    rakesh487, Mar 26, 2019
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.