Public Lab Research note

  • 2

Using 2 camera try to find NDVI Image. Please verify my image .

by Kalarav |

Hello to all, I am An Embedded enthusiast  right now I’m working on to find NDVI images and it's index. I have already purchased Infagram plant camera and lens to explore it. I'm Using OV5642 camera to capture images using different lenses so it is working fine. I have purchased different lenses from Which is list is as per below. 1. RGB Generic camera lens 2. 650  (Red Interface Bandpass) 3. 850  (Near - IR Bandpass) 4. 660/850  (Red + NIR) 5. 475/550/850  (Blue+green+NIR) 6. 550/660/850  (Green+Red+NIR)

So , As per standard method I'm using 2 different Camera for Image Capture 1.RGB  & 2.NIR at same time, using this RGB camera I can easily extract the Red Channel Image it is possible using 650(Red Interface Bandpass lens) also using NIR I’m able take images in Good Sunlight.

I'm Using this standard equation for evaluating using Python + Opencv. (nir_img-red_img)/(nir_img+red_img) So I’m Getting this kind of image as NDVI Output. Please find the below hyper linked text for images.

RGB Input Image NIR Input Image NDVI Output Image

Due to different camera it is not aligned same together. so , I need to take some images from internet for reference purpose to check Python code is working or not so , I have taken another two images from internet and evaluate it using my code which as per below.

Reference RGB input image Reference NIR input image Reference Image NDVI output.

Please verify my Input Images and NDVI output Image it is Perfect or Not. It is Two camera solution. Here is the link for camera set-up Image

Is it possible to Find perfect NDVI using Single camera solution (Due to alignment error of two camera) using below lens.? 1. 475/550/850  (Blue+green+NIR) 2. 550/660/850  (Green+Red+NIR)

Thanks in Advance.

Best Regards Kalarav

ndvi nera-infrared


It will be important to modify your two camera system so the photo pairs capture the same scene. It will also be important to align the two photos so they overlap perfectly using something like a SIFT algorithm.

It is not possible to evaluate the NDVI results from the photo pair you posted from the internet (without attribution) because there is no key to the colors.

Using a single camera system will eliminate the problem of aligning two photos but will introduce another problem which is that it is impossible to get both red and NIR channels which are not contaminated with other wavelengths.


Hi Kalarav,

These links may be good resources for aligning the NIR and RGB images on your project:

Blog post:


A couple of thoughts:

You'll definitely need to align your images to calculate the NDVI image

If you put your lenses as close as possible, the alignment process will be easier/more precise

It looks like your cameras have different lenses (different FOVs?). I think that capturing both images using the same lenses is better.

Good luck!

@cfastie : HI cfastie, Thanks for your kind response. I am using modified camera in these cameras I'm using customized lenses 1. Red bandpass 650 2. NIR 850 Using this I'm capture image at same time. I'm in Primary stage so If possible I'll fix the camera alignment or using SIFT algorithm as per your suggestion.

Reference images taken from Internet which already used in kind of NDVI processing. Like RGB image and NIR image it is just for to test python algorithm and NDVI output so, please tell me about that image of NDVI output is OK or not. If need to some improvements please suggest me some good ideas. Which solution is best single camera or double camera.? I'm ready to use double camera solution as well so, Red bandpass image and NIR image is best for to find NDVI.?

Thanks in advance

Best regards Kalarav

@jarrate Dear jarrate, Thanks for your kind words. I'm in Primary stage to find NDVI so need to some improvements in image capture process and post process. But right now I want to finalize the camera lenses using two camera solution which is best for find NDVI.

Thank you very much for giving me good reference for opencv process. I'll check it as soon as possible. Due to some different images is it possible to process both RGB and NIR image to alignment.??

Please advise me. Thanks in advance

Best regards Kalarav

@Kalarav, yes, I think it's possible to align the images, even when one is RGB and the other one is NIR. Actually, the examples in the blog post discuss the alignment of the R, G, and B channels on mis-aligned photos. I think that the problem discussed in the post is very similar to trying to align a RGB (converted to grayscale) and a NIR channel.

Good luck!

@jarrarte, Thank you for your support in image alignment in process and it is completed 75%.

I have some doubts regarding NIR Image. we are using MIDOPT 660_850(RED_NIR only) lens to capture image( attachment: 660_850_Original.jpg). Using 660_850 camera lens we are able to capture images. NDVI = (NIR-RED)/(NIR+RED) So, Using 660_850 camera lens and using image processing we have to extract red image(attachment: 660_850_RED.jpg) from original image but we haven't idea how to extract NIR Image from the original image. we are using OpenCV + PYTHON for image processing. Using RED and NIR image only it is viable to process NDVI.

With Best Regards, Kalarav

Please provide me a good solution. 660_850_RED.jpg


Your image "660_850_Orginal.jpg" is a grayscale photo. The photo taken with your camera should be a three color photo with different values in the three channels. Use the red channel of that photo for red and use the blue channel of that photo for NIR.

@cfastie: Thank you for your kind suggestion. In the early stage, we have concluded that two camera solution needs more synchronization of alignment and same focal length. So, we have to need some more research regarding single camera solution. so, we are testing on Dual bandpass filter ( which is only RED and NIR image only. Basically, i have taken a photo using 660_850(RED_NIR) filter actually it is not a grayscale image. when I capture the image in an indoor area it is a reddish image INDOOR IMAGE: ind_R_N_Orginal.jpg

But when I'm capturing an image in open environment it image is capture like grayscale

OUTDOOR IMAGE: otd_im_Orginal.jpg

Then after as per your suggestion, I have used Blue channel as NIR image. and used algorithm: (blue_img(NIR)-red_img)/(blue_img(NIR)+red_img):

Original outdoor Image of 660_850 (RED_NIR) image:


Red channel image: otd_im_Red.jpg

Blue as NIR Image: otd_im_Blue.jpg

NDVI output image :


then after i am using algorithm. (red_img-blue_img)/(red_img+blue_img)

then NDVI output image.


I m confusion that is it possible to process NDVI using dual bandpass filter 660_850? using single camera solution NDVI is possible or not?

Best Regards Kalarav

Sorry I was wrong about your original photo being grayscale. You are correct that it is color photo. All three color channels are extremely similar, so it appears to be a grayscale photo. That photo will not produce good results when converted directly to NDVI. NDVI for healthy foliage is in the range 0.3 to 0.7. To compute a value in that range, the NIR value must be 2 to 8 times greater than the value for red because healthy foliage in sunlight reflects 2 to 8 times more NIR than red.


Your photo has about the same value for NIR as for red because your camera is not as sensitive to NIR as it is to red. This is true of all consumer cameras.

It is possible to crudely compensate for this by adjusting the white balance setting on the camera so the brightness of the blue channel (NIR) is exaggerated. This is easy to do on the Mobius camera and many point and shoot cameras.

Adjusting the color balance after the photo is taken should also be possible, but probably only if you capture the raw image data. I have not seen this done successfully.

To repeat, it is not possible to evaluate your NDVI images because you do not include a color key.


Dear @cfastie, Thank you for your kind response. Actually, I'm not getting the meaning of Color key. I'm an apology for that. It's kind of NDVI BAR or NDVI Index value bar? For ex.: ndvi_bar.jpg

Right Now, I'm Working with the single camera to find out the NDVI I'm Using BGN-475-550-850 (Blue+Green+NIR) lens to post process Image. Blue using as a Visible image and Red using as NIR image for NDVI Processing. I'm also using website online tool for NDVI post processing. Original Image: BGN_Original.jpg

Infragram tool output: 2017-09-06T09_16_28.932Z.jpg

My NDVI Output: BGN__NDVI.jpg

Between Both output images, there is a major difference is Color. Can I use color mapping for my output image to convert the same color as infrgram output image?

I had read about the camera calibration technique. Is it necessary for the single camera solution? If yes what kind of setting is needed for that? like, Auto white balance, Hue, saturation.

Thanks and regards Kalarav Parmar

The original photo above has some potential for conversion to NDVI, but the red channel (NIR) is not very much brighter than the blue channel (blue) for areas of the photo with foliage (marquee):


In a photo that can be converted directly to NDVI, the NIR channel will be shifted to the right more (brighter) than the visible light channel.

I used Ned's Photo Monitoring plugin for FIJI to stretch the histograms of both channels and compute NDVI. Then I added 15 to the DNs for each pixel to get this:


The color key is applied to the image based on the DN for each pixel. The range of DNs from 0 to 255 translates to NDVI values of -1 to +1. The NDVI value for foliage (green) is about 0.2 which is probably too low for healthy foliage.

What camera did you use?

Dear @cfastie, Thank you very much for your response. I'm Using OVF5642 Camera ( Midopt 475/550/850 BGN Lens. (

Thanks and regards Kalarav parmar

You must be logged in to comment.