Public Lab Research note

Moar NIR tracking

by cfastie | September 12, 2013 02:58 12 Sep 02:58 | #9316 | #9316

Image above: An NIR LED under tungsten light. The faint purple glow of the LED can be discerned in this photo from an unmodified camera (Powershot A495, ISO 200, 1/4 second, f 3.0).

Here is the response of a couple more cameras to an NIR LED. The same setup described here is used. The cameras tested are an unmodified Canon Powershot A495, and a Canon Powershot G11 modified by Lifepixel with a Schott BG3 filter replacing the IR block filter.

Histograms for small areas (square marquees) of photos of an NIR LED in a dark room. Both photos were taken with an unmodified Canon A495. The camera's IR block filter was in place, so it was not very sensitive to NIR. The LED is casting its glow onto the white frosted-glass globe. The camera's "Sunny" white balance preset was used for the top photo, and the "Fluorescent" preset for the bottom photo. (both: ISO 200, 1.0 second at f/3.0)

Histograms for small areas (square marquees) of photos of a white frosted-glass globe with an NIR LED inside. All photos were taken with a modified Canon G11 with a Schott BG3 filter. The camera's "Sunny" white balance preset was used for the top photo, and custom white balance presets on a gray card (in sun) or blue fabric (in shade) were used for the others (these custom white balances were done outside, not with the NIR LED). (all: ISO 200, 0.5 to 0.8 second at f/2.8)

The results here are consistent with the conclusion that the standard white balance presets in Powershots are all very similar, but a custom white balance can dramatically change the relative amount of light in the three color channels of a photo. These results also support the idea that flooding the sensor with blue light while performing a custom white balance reduces the amount of NIR (and visible blue) light that will be assigned to the blue channel.

Histograms are explained here.


This white balance stuff got me thinking. I don't think the white balance actually changes the amount of light recorded by the sensor but instead modifies what is recorded by the sensor using the assumption that whatever was used as a white balance target has an even color response across all wavelengths recorded by the camera. That's why you get great blue band separation using a blue white balance target as you describe here: In effect the custom white balance an on-board Infragram snadbox ( I wonder if you recorded using RAW to actually know what is being recorded by the sensor you would be able to predict the response to different white balance targets. In other words would you be able to simulate algorithms from the Infragram sandbox simply by using custom white balance. It seems straightforward to me but things usually do until I actually try it.

Reply to this comment...

I love the theory that the blue card is flooding the blue channel to minimize or outweigh or "wash out" the infrared from that channel. I think that makes some sense -- the sensor should be much more sensitive to visible light, and if we have a high-reflective blue card, it should allow us to balance the relative amounts of blue and IR.

A test to try -- see if the blue cards we use are bright or dark in the infrared range!

Reply to this comment...

Ned, The G11 photos in the panel above were recorded in camera raw. According to my naïve model of what camera raw does, it should be possible to take any one of those three photos and turn it into either of the other two (they differ only in white balance). This can’t be done with the infragram sandbox because that does not accept raw files. With the proper program that reads raw files and allows manipulation of all of the data, it should be possible. Adobe Lightroom reads the raw files, and I think it makes all the raw data available, but it does not have a complete set of manipulation tools (no channel mixer). RawTherapee is a free open source raw editor with very complete tools. I can indeed take any one of those three G11 photos and make it look a lot like any of the others using RawTherapee. But those photos are an easy case because they sort of have only one hue and are made from monochrome light. I have not been able to make a nice orangey Infragram photo out of a purpley Infragram of a real outdoor scene. I suspect it is possible but maybe tricky. It is probably not possible when all you have to start with is a jpg image. It might be that white balancing after the fact will not work well if you don’t have raw files.

Reply to this comment...

Jeff, Our goal is to have 1) a red channel which records how much NIR is reflecting from plants, and 2) a blue channel which records how much blue light is reflecting from plants, and 3) a ratio between those two channels (in each pixel) that is close to the actual ratio reflecting from the plants.

When you flood the sensor with blue light during custom white balance, you are setting the camera to de-emphasize the light hitting the blue pixels, relative to the red and green pixels. The value in the blue channel of each pixel will be made smaller, so when the color of each pixel is determined, less blue is involved, and when NDVI is computed the blue value is smaller. The camera does not know how much of the light hitting the blue pixels was NIR (or green or red); it assumes everything getting through the blue Bayer filter is blue. We don’t know the actual NIR:blue ratio in the ambient light or the NIR:blue ratio of reflectance from the blue paper during custom white balance. We are using the custom white balance process to crudely nudge the camera to modify the ratio of "red" to "blue" in each pixel. If we nudge it just the right amount, the pixels from plants will have a "red:blue" ratio that produces meaningful NDVI. Calibrating this nudge should be possible with a light source of known NIR:blue ratio. So a particular colored card held under a particular light bulb should provide the proper nudge. What we have been doing outside in sun and shade and clouds, etc is probably too variable to standardize. Maybe what we need is a colored card that works under a compact fluorescent lamp (although they don't seem to emit much NIR).

Reply to this comment...

Definitely the IR and vis are mixing unmeasurably, but I'm wondering if the blue card contributes to the sum amount of light being reflected in the blue channel, or if it is minimizing IR (absorbing it) and giving the WB algorithm a value which really corresponds mostly to visible light, or to combined light. I guess we could explore this by calibrating with a blue card with a no-IR light vs. full spectrum light, and also by photographing the blue paper with a pure NIR cam.

Reply to this comment...

My guess is that you would get the same effect that you get with a blue card if you used a gray card and then multiply the blue channel by a factor like 0.6. That might be a reasonable way to deal with cameras that can't do a white balance - just multiply the channels by a factor to get sensible results.

Reply to this comment...

Login to comment.