2

How does the transmission of the raspi non-ir-filter-cam work? Can I get a forth value "ir" in a pixel (r,g,b,ir)? Or is an ir pixel just white? In the end I want to have a python script that has a list of pixels with ir pixels, in, for example, a jpeg format.

  • You should clarify where you expect to find these pixels, beyond the very ambiguous "data transmission". Is it in a jpeg image created by raspistill or some other app? Some particular library interface? – goldilocks Oct 27 '15 at 22:35
  • Yep. Jpeg created by raspistill in python @goldilocks – palsch Oct 28 '15 at 6:03
  • I got asked a similar question in issue #137 of picamera. TL;DR: you can't do this - the IR "information" winds up mixed into the red, green, and blue channels and there's no way to separate it out again but see that ticket for a pretty graph showing why! – Dave Jones Oct 28 '15 at 20:49
  • @Dave Jones Huh. Looks very complicated. Too complicated for the little little project I wanted to do. – palsch Oct 28 '15 at 20:51
  • I wanted to have glasses so you can see IR as red and every other color (althought ir is no color thanks to @goldilocks answer) compressed. (the color range would be compressed)... Extend the senses! :) – palsch Oct 28 '15 at 20:54
2

There is no such thing as IR pixel values, at least, not in the sense of a fourth channel independent from RGB.

The NoIR camera is the regular camera with a filter removed. Presumably this was marketed in response to occasionally successful efforts made by people to remove it after market.

I'll give you my understanding of how a color image is produced by the camera, thanks in part to Dave Jone's comment above.

The camera uses a CMOS sensor array. Although these sensors, one per image pixel, are not uniformly sensitive to all frequencies of light, they do not detect wavelength in any precise way; they measure intensity. Color is produced by filtering the light in a very fine grid (a Bayer filter) over the sensors such that each one ends up representing one of three bands (red, blue, or green). Subsequent to this, each pixel has values for the other two bands added by software which (in its simplest form) interpolates them from neighbouring sensors. Pretty clever.

The Bayer filter, however, does not always perfectly balance color intensity because of the significance of non-visible IR and UV light, which affects the CMOS sensors. Hence the role of the IR filter, which is actually an IR/UV filter, though the IR is more of a factor because of the bandwidth sensitivity of the sensors (see the graph in the discussion linked by Dave, and note that the Bayer band blocked the least by the IR filter is the middle one, green).

If you look at a collection of images from the NoIR camera, you'll notice ones that were taken in normal light look washed out because of the added contribution to the blue and red sensors, which is half of the total (50% of a Bayer filter is green, in keeping with the proportion of red/green/blue photoreceptors in the human eye).

Photos taken in very low light tend to look grayscale, presumably because of amplification of the interpolated RGB pixel values.

However, the NoIR camera can also be used with a filter that comes with it to produce false color images similar to those familar from more dedicated IR sensors. In the case of the raspicam this is sometimes done with NDIV, where the pixel intensity (taken from that wikipedia article) is:

(NIR - VIS) / (NIR + VIS)

Here NIR is light in the near infrared range and VIS is in the visible range. These ranges overlap, since the visible spectrum is about half and half "near infrared" and "near ultraviolet". The external blue filter used gets rid of much of the latter, and using this formula (where the two values extend from 0 to infinity) will produce a value ranging from -1 to 1, where the intensity is a measure of near infrared in the absence of near ultra-violet, and that range has corresponding false color values. This is used in plant photography because plants will absorb a part of the spectrum that actually corresponds to our visible light, but scatter the lower part of near infrared (i.e., that below the visible spectrum).1

ir pixels, in, for example, a jpeg format

JPEG images use up to three values to represent the color of a pixel; I think these are usually YCbCr values that are translatable into RGB (JPEGs may also contain greyscale). Three values are suited to representing colors we recognize since colors are a product of the distribution of three types of cone cells in the human eye, each sensitive to a specific band of visible light (the red, the green, and the blue). Which takes us back to the physical Bayer filter. Which does not have a dedicated IR component.

Some other image formats do include a fourth value, alpha, which is a measure of transparency. For hopefully obvious reasons, this is non-nonsensical in photography (nor is it part of a color), although you can take a photograph and subsequently make part of it transparent and store this in a (non-jpeg) format which includes alpha values.


1. The Foundation has their own discussion of this explaining the purpose of the blue filter. This kind of plant oriented photography does not necessarily use false color NDIV, but there are some examples of such here.

  • 1
    Very much good information. Thanks! (sorry, I can't upvote since I only have 8 rep) – palsch Oct 28 '15 at 15:08
  • Yea up voting seems to be a myth on here recently... virtual upvote +1 – Piotr Kula Oct 28 '15 at 15:11
2

The no filter camera, is basically what is says. There is no Infra-red filter applied before the CMOS, so IR light can pass into the sensor, the standard camera removes this IR light from BEFORE it hits the CMOS.

Capturing IR as you would like to may not work as expected. You cannot capture IR data, for example TV remote control pulses or something, the frame rate is just tooooo low! Remotes operate in khz cycles and what looks like a light to us are actually hundreds of pulses in milliseconds.

If you build your own IR transmitter, the fastest speed you might be able to achieve if 30, 60 or 120 baud! (that is 1 bit per frame, given no frames are lost!) You could divide the image into 4 areas, giving you 4 times more speed but calibration will be a pain in the back!

To detect if IR was shone into the sensor, there is no extra parameters, no. As far as the CMOS is concerned this is just bright light, you may be able to extract it using OpenCV? Or some custom JPEG parser or something.

If you need data transmitting you should use a IR kit and hook it up to the GPIO.

enter image description here

The NoIR filter is usefull in low light applications, light night time with the use of IR cannons, that illuminate the environment without the naked eye seeing this. Like a basic night vision light.

  • 1
    I'm so sad that I can't upvote. :( – palsch Oct 28 '15 at 15:09
  • I'm so sad nobody is up voting you, even though there's allot of activity here. Glad you found your answer anyway, hope to see you around. – Piotr Kula Oct 29 '15 at 9:00

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.