# What is the best way to calculate the Normalized Difference Vegetation Index (NDVI)?

With the nano I’m streaming 3 video feeds simultaneously, see image. The black and white image in the left is a near infra red picture (NIR), the picture in the middle is a thermal image (LWIR) and the full screen image is the visible (Vis) picture. Now I would like calculate a new image using the NIR and the Vis images according to the scheme new_image=(NIR-Vis) / (NIR + Vis). After standardization the operation results in an image with a value range from -1 to +1. Therefore it is called normalized. The NDVI image allows the investigation of the health of the vegetation. Later the cameras are mounted on a multicopter, see also Nano Projects.
I have some experience with Pascal and Fortran, but not with C++, Python or Opencv.
My questions are:
Is the task basically possible?
What would be the best and easiest way/language to perform the above real time calculation on the jetson nano? Two or three images per second are ok.

It would be very nice if someone creates a simple example for me. For test purpose we should use two videotestsrc pattern=… feeds first.

Many thanks in advance,
Best regards,
Wilhelm

Hi,
You may see if some other users can share you suggestion on the algorithm. For implementation, it can be a good solution to implementation the algorithm via CUDA for parallel computing.

I have solved the task using gstreamer, opencv and Python. Here are two benchmarks (without CUDA):
From two test videos a new one was calculated according to the formula ((A-B) / (A + B)) / 2 + 0.5.
The Nano calculates 9 frames per second in B/W and 5 frames per second in color at HD resolution(1280×720). The Nano with the Sd-card image is a very nice system.
Best regards,
Wilhelm

Glad to know issue resolved, thanks for the sharing!