Public Lab Research note

NDVI from PiNoir with a blue filter

by carolccarvalho | February 18, 2016 23:16 18 Feb 23:16 | #12712 | #12712

What I want to do


I'm using a PiNoir camera with a blue filter to take ngb pictures. As I need to do a color balance before turning the picture to ndvi (I'm not using awb_gains) I created a matlab routine to do this adjustment automatically.

Since I take the pictures with a piece of blue paper, that is my calibration parameter, I insert the location of the blue pixel and it adjusts the red and blue channels until it becomes gray. In the same code, after doing the color balance, matlab turns the photo in ndvi. I've been using vgyrm gradient.

My attempt and results

I think that the conversion to ndvi is correct. I compared the results with Fiji's. Some results and foliage related histograms are shown below.

1 -



2 -



3 -



Questions and next steps

The problem is that I'm not sure if I'm doing color balance correctly in the pictures and if is it possible to increase these results somehow...

For the same plant, the results were very different. Some areas are magenta colored and I think that the leaves doesn't show high ndvi values (>0.9) so I guess that's ok. But some other areas (not foliage) showed values between 0.2 and 0.9 and I don't know why, since there is no photosynthesis occuring there.

Please could you guys confirm if those results are correct and, if not, what can I do to try to correct them?


other areas (not foliage) showed values between 0.2 and 0.9 and I don't know why, since there is no photosynthesis occuring there.

Getting high NDVI values doesn't require photosynthesis, it just requires a big difference between the values in the blue and red channels. In natural areas, few surfaces (other than leaves) have a color with a big enough VIS/NIR difference. But an indoor photo that has been manipulated to exaggerate the red channel could have lots of pixels with such a difference.

Are you capturing RAW images? Lots of good single camera NDVI photos have been taken with an artificial custom white balance that exaggerates values in the NIR channel. I have not been able to recreate this exaggeration after the fact if it was not done while the photo was taken. If RAW images are captured, it should be possible to recreate the adjustment, but adjusting a jpeg photo that has already been manipulated by the camera firmware probably cannot reproduce the effect of an in-camera custom white balance.

The post processing adjustment you are making has not only increased the red values, it has also decreased the blue values. Many blue values are near zero even in areas that are not black. When computing NDVI (for a blue filter: (R-B)/(R+B)), as B approaches zero, NDVI approaches R/R which equals 1. So many pixels with low B values are producing NDVI near 1.0 (magenta). This might be an artifact of the way your color adjustment was done. Maybe a different color blue paper would produce different results.

Also, calibrating the process under indoor light with non-natural surfaces might not transfer well to outdoor situations.

The KAPtery

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

Reply to this comment...

Login to comment.