Public Lab Research note

Multispectral raspberry pi: first light (NDVI images)

by khufkens |

Read more:

khufkens was awarded the Basic Barnstar by nachokhan for their work in this research note.

First light

I just wanted to share my first images from the multispectral raspberry pi. I currently have two cameras running on the camera multiplexer. One standard RGB pi camera and one NoIR pi camera with a blue rosco filter.

Below you can find two NDVI images (plus the original RGB image) generated from either a combination of the bands from the two cameras or a standard infragram processing (using Ned Horning's Fiji Plugin). For reference, black is 0, white is 1.

Note that the fidelity of the NDVI image from the split camera setup (multiplexer) generates images with a far higher range in values then those solely generated using the NoIR infragram camera. Also note that with distance the signal decreases for the infragram as well, where the row of trees in the back for the dual camera setup shows a far less pronounced distance effect due to raleigh scattering of blue light (thanks cfastie for reminding me of this).

I ordered two glass filters, one bandpass filter (400-700nm) and one longpass filter (> 721nm). This should allow me to increase the contrast even further using two NoIR cameras. The reason for no using a single red bandpass filter is to allow me to retain a visible light image which is well defined (I know what filters I use - instead of guessing on the response of the cut filter of the raspberry pi camera ). This visible light image will allow me to calculate other indices as well e.g. a greenness index (Gcc) or maybe an enhanced vegetation index (EVI).

I will try to characterize this spectral response of the colour raspberry pi camera as well as the NoIR one in the coming weeks or so, but until then I'll make due with two filters and two NoIR cameras.

Two camera setup

NDVI - two cameras

single camera infragram

NDVI - single camera

colour scale scale


RGB - single camera

ndvi raspberry-pi infragram multipspectral



Koen, These NDVI images look really good. There are multiple reasons that could explain why the trees in the distance have lower NDVI values with the blue-filtered single-camera setup. One very common artifact is caused by scattering of blue light by the atmosphere. Images of distant things look bluer (have higher values for blue) because more blue light coming from all directions gets scattered toward the camera. If you are using the blue channel to represent visible light in calculations of NDVI, higher blue values will compute to lower NDVI values. If you used the red channel to compute NDVI in the two-camera system, red values will not have been inflated by scattering, so that could explain the difference. This Raleigh scattering is one reason to use a red filter instead of blue in single camera systems. Here's an old note about this:

The 721 nm filter should produce a good pure NIR photo. I'm not sure what the 400 to 700 nm filter will do for you. An unmodified camera gives you that range already. A narrow band red filter might produce a pure red image and better replicate legacy NDVI. But exposure time or aperture will have to compensate for reduced light reaching the sensor.

You might want to try the lut below in Fiji (copy the lut file into the Fiji luts directory). The features of this lut are explained here: Feel free to include the jpg below if you post NDVI images made with that lut. .


Thanks @cfastie for reminding me of the Raleigh scattering, my equally scattered Sunday evening brain didn't quite put two and two together. The reason for using the 400-700nm filter is to be sure of the range I'm looking at (I know the specs of the filters I use, I don't of the ones that are in the pi cameras). The reason to use this approach instead of just using a single red bandpass is that using the 400-700nm filter will yield me a standard RGB image which is usable in other ways. Mainly I can still use the other channels to calculate a Gcc index (G/R+G+B), using a red bandpass would remove this option. I'm trying to get the most out of the setup (in terms of data streams as well as channels).

I changed the images to your scale. Looks nicer this way. It makes the difference in dynamic range all the more apparent.

Good Job Khufkens I have interest in developing research NDVI using raspberry pi. I still need to learn a little more about it , but I was very enthusiastic about the result.

Sir, did you use any technique or calibration of pinoircamera's white balance?

Is this a question? Click here to post it to the Questions page.

@khufkens did you set a white balance on the Raspberry Pi for the Infrared image? I use a NoIR V2 camera with the Thorlabs RG9 longpass filter.

Is this a question? Click here to post it to the Questions page.

The Raspberry Pi v2 camera uses a Sony IMX219 sensor. Here is the spectral response of the sensor found in their datasheet.


You must be logged in to comment.