Ask Your Question
0

Subtracting data for NDVI

asked 2019-11-05 03:19:09 -0500

SimonKirkman gravatar image

I am trying to calculate ndvi from two images (one RGB and one from an NOIR camera), with thee aim of taking the red out from the RGB and the Near infrared from the NOIR. Firstly how would you identify the NIR in openCV as it only has 3 colour channels (RGB) and second how would you merge these 2 images using the NDVI formula pixel by pixel?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2019-11-05 04:03:30 -0500

kbarni gravatar image

updated 2019-11-05 09:35:10 -0500

The NoIR is just a color camera with the IR cut filter removed(so it will capture visible+infrared light). You can add the included filter (that dark blue film) to cut most of the visible light. Than just convert the grabbed image to grayscale to get an approximation of the IR light.

Then just apply the NDVI formula pixel by pixel (untested code):

redp = color.at<Vec3b>(y,x)[0];
irp = ir.at<uchar>(y,x);
ndvi.at<double>(y,x) = (irp - redp) / (irp + redp + 0.001); //the 0.001 is to avoid the div/0

Anyway, the problem is that these cameras are not calibrated. You are combining two images that don't have the same exposure. Worse, you don't know the IR sensitivity of the camera compared to the visible sensitivity. The visible cut filter is also a cheap film, so don't expect perfect results (a good quality visible cut filter is totally black). So this setup is good to play with, but won't give you a reliable NDVI index.

edit flag offensive delete link more

Comments

What would you recommend as the ideal way to get NDVI. Which single camera or combination would be the best way of getting a good quality index?

SimonKirkman gravatar imageSimonKirkman ( 2019-11-05 12:21:04 -0500 )edit

Google NDVI camera. I never tried them, so I can't really do a recommendation.

kbarni gravatar imagekbarni ( 2019-11-06 03:18:56 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2019-11-05 03:19:09 -0500

Seen: 89 times

Last updated: Nov 05 '19