Message Boards Message Boards


Analysis of crop health using NDVI (Red and Near-infrared capturing camera)

Posted 1 month ago
2 Replies
5 Total Likes

Hello Wolfram Community,

I want to take pictures of crops using a drone and better highlight the contrast between regions of healthy vegetation vs. areas with stressed/diseased or no vegetation (in future, extract more information about the crops).

I have recently removed an infrared blocking filter from a camera of a DJI Phantom 3 and instead mounted a filter that blocks every wavelength except Red and Near-infrared. I want red and near-infrared light because healthy vegetation will absorb red light and strongly reflect near-infrared light.

Incorporation of this filter allows reflected red light (660nm) to be captured in the camera sensor’s red channel and reflected near-infrared light (850nm) to be captured in the sensor’s blue channel (the green channel is not used). NDVI can be determined by performing the calculation: NDVI = (blue – red) / (blue + red).

Could you please tell me how to make a heat map (maybe using DensityPlot) or any other way to better highlight the contrast instead of the Colorize function? Or if anything comes to your mind, I would be glad to hear!

enter image description here enter image description here

This is my first attempt in post-processing.

An approximate regular camera picture of the grass spot: enter image description here

ColorSeparate[enter image description here, {"R", "B"}]

Out[1] = { enter image description here, enter image description here}

f[pixel1, pixel2] := (((pixel1 - pixel2)/(pixel1 + pixel2)) + 1)/2;

ImageApply[f, {enter image description here, enter image description here}]

Out[3] = enter image description here

The darker spots are supposed to be less healthy vegetation.

Colorize[enter image description here]

Out[4] = enter image description here

2 Replies

Nice project, Zhamilya! The image obtained with the filter seems to have an optical aberration on the borders. Cropping the borders of the image with ImageCrop will get you better result:

Colorize[ImageApply[f, ColorSeparate[imgCropped, {"R", "B"}]], 
 ColorFunction -> "ThermometerColors"]

enter image description here

Another observation is that your grass image contains several types of plants that could alter your results. You could try to highlight these plant species directly using your raw image (without red filter). For example you can experiment a bit with ClusteringComponents, MorphologicalComponents, ref/WatershedComponents, DominantColors functions:

Colorize[ClusteringComponents[img, 4] , ColorFunction -> "Rainbow"] 

enter image description here

By the way, some time ago @Arnoud Buzing analysed crops by drone too. You can check his cool post here:

Keep us updated on the progress of your exciting project :)

Thank you very much for suggestions, Jofre! I will experiment with ClusteringComponents, MorphologicalComponents, ref/WatershedComponents, and DominantColors functions.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract