# Filtering certain wavelengths from the camera RGB videostream

Hello,

We are using ordinary CCTV cameras to grab color pictures. The representation of the picture in our image processing application is in RGB format.

Is it possible to determine wavelength of the light at particular pixel from RGB values ? The purpose is to cut out all the white light and keep only infrared spectrum (above 850nm). We need software solution, because hardware solution (like IR pass filters on lenses) is not acceptable for us.

bandpass filter

bandpass filter

We can't use hardware filters. Our solution must be done completely in a software.

When the RED light comes to the CCD sensor, the CCD produces value RGB=[255,0,0], the GREEN light is [0,255,0] and so on ...

The problem is that when IR light of frequency approximately 850-900 nm comes to the CCD sensor, the sensor sees the light as a grayscale, that meas RGB value is for instance [5,5,5].

We are looking for a mathematical formula, using which we will be able to convert RGB value into the wavelength.

That means RGB value of [255,0,0] will be converted to 700 nm for instance, and RGB value infrared light will be converted to 850 nm.

dlgoff
Gold Member
I don't think what you are wanting to do is possible with a RGB signal.
The RGB color model is an additive color model in which red, green, and blue light are added together in various ways to reproduce a broad array of colors.
http://en.wikipedia.org/wiki/RGB_color_model" [Broken]

Not only that, but red is visible red not infrared.

Last edited by a moderator:
Is it possible to determine wavelength of the light at particular pixel from RGB values ? The purpose is to cut out all the white light and keep only infrared spectrum (above 850nm). We need software solution, because hardware solution (like IR pass filters on lenses) is not acceptable for us.

A software solution is not possible. The information isn't there...you don't know anything about the specific wavelengths the illumination is composed of, only the total intensity of illumination in three bands (for a color camera) from the visual range. Any IR signal is contamination that got through the color filters and is indistinguishable from visible light.

It's not an issue of it being hard or computationally expensive, that information just doesn't exist in the output of the camera. Your only options are to use a real hardware IR-pass filter on the camera, or to do something completely different from what you described.

sophiecentaur
Gold Member
2020 Award
There is some very muddled thinking going on here.
For a start, the basic answer to the question is no.
The following only applies to additive (TV, type) colour reproduction: film is messy and different.
Analysis:
Colour imaging systems use three sensors with analysis curves which are definitely not just 'Red', 'Green' and 'Blue'. All three sensors cover a wide range of wavelengths and match, as closely as practicable, the eye's response with its three colour sensors.
See this Wikki link http://en.wikipedia.org/wiki/CIE_1931_color_space. You percieve a colour (note- not wavelength) because of the relative levels of the signals from the three (very broad band) sensors. These signals are not called RGB but xyz - they are reddish, greenish and bluish, if you like but R, G and B signals only emerge from the process when you want to synthesise a colour. Many different combinations of light of different wavelengths will give you the same subjective 'colour' response. There is no reason to expect to perceive infra red as equal combinations of R,G and B - there is zero response of the blue(ish) sensors to i.r..

Synthesis:
It is possible to synthesise colours which will match the original, subjectively, using suitable combinations of levels of Red, Green and Blue light (Primaries), produced by, say, the phosphors on a TV screen and added together. To get a bright picture, these primaries may well not be 'spot' wavelengths. The RGB signals from the camera (etc) represent the signal which need to be applied to three phosphors (or equivalent) to produce the desired colour sensation.

If you are told that a certain RGB combination was produced from a single wavelength of light then you can work out that wavelength (Look at the CIE chart on the Wikki link) - but other parts of a real picture could have the same RGB combination. So you could not say that you could 'filter' out a particular wavelength - just eliminate a certain colour.

You could identify areas of a picture which were dominated by 'generally far red' signals, where X is much higher than Y and Z, but that's all.