Public Lab Research note


Updated photo monitoring plugin to compare NDVI with DVI

by nedhorning | June 24, 2014 14:25 24 Jun 14:25 | #10610 | #10610

I finally got around to updating the Photo Monitoring Plugin that runs in ImageJ/Fiji (https://github.com/nedhorning/PhotoMonitoringPlugin). The main addition is a dropdown menu that allows you to pick the type of two-band index you want to create. For now the only two options are NDVI Normalized Difference Vegetation Index) and DVI (Difference Vegetation Index). I updated the guide to reflect those changes. I also added two of the LUTs that Chris Fastie frequently uses. If you use the new plugin please let me know if something doesn't work as expected or if the guide or interface windows don't make sense.

I had been wanting to add additional indices to the plugin and a recent discussion on DIYDrones prompted me to add the DVI so people can compare that with NDVI.

The NDVI and DVI output images in my limited tests are nearly identical if I scale the NDVI from 0 – 1 and DVI from 0 – 255. NDVI tends to increase values in shadow area and DVI tends to decrease values in shadows. So, if the shadow falls over soil or other low vegetation area DVI will be “better” and it the shadow falls over vegetation NDVI will be “better”. In light shadows NDVI seems to give better results but it's difficult to tell which is really “better or worse” with out some rigorous testing. Hopefully adding a DVI option to the plugin will make comparisons easier. Please report your findings.

In the figures below you can see examples from a dual camera system with one unmodified and one NIR pass filter camera (upper figure) and also a single camera with a red Wratten 25A filter (lower figure). Note the shadow in the lower left portion of the image. Note the shadow to the right of the concrete block. The images were not calibrated.

DVI_NDVI_Compare.png

RedFilterDVI_NDVI_Compare.png

LUT.png


15 Comments

Thanks for all the work you've done on this amazing tool. Nice enhancements, put in context.

Reply to this comment...


Awesome, great work Ned!

Reply to this comment...


The images created on ImageJ/Fiji generate values ​​from -1 to 1, although being in the range from 0 to 1. Creating images as figures 0-1?

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

Reply to this comment...


When I created the images above I scaled the output so and NDVI or DVI values less than 0 were set to 0. To include the full range of possible values I could have used -1 to 1 for NDVI and -1 to 1 for DVI but for the most part I'm not interested in the negative values.

The advantage of reducing (in my case by half) the range of values is that it lets me see finer changes in NDVI or DVI values.

Reply to this comment...


Ned, Using a red filter, does the plugin subtract the blue (NIR) band from the red (red + NIR) to get a red band and then do the NDVI & DVI math on the results?

Same question for the blue filter - does the plugin create a NIR and R layer and then play with the pixel math?

Thanks,

Alan S. Wicks Kennewick, WA

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

Reply to this comment...


Hi - At this point the plugin does not subtract the NIR from the red. I've been doing this subtraction as part of my calibration tests: http://publiclab.org/notes/nedhorning/06-23-2014/calibrating-raw-images-a-step-toward-jpeg-calibration

At some point I might add that to the plugin. If you have ideas on sensible ways to do that I'd be happy to discuss it.

Reply to this comment...


Hi Ned, I have a son who is a pretty good programmer and knows Java. I talked to him and he is seeing if he can use your plugin and add a piece to create just a red layer out of the R+NIR layer so that we can then feed it into your system so that we can create whatever relationships we want.

I'll keep you appraised.

Alan S. Wicks

Reply to this comment...


Hi Alan, That sounds good. The first thing your son will realize is that I'm not a very talented programmer. I'm traveling until early next week but If he has questions about the code he can feel free to contact me.

Reply to this comment...


I don’t quite understand how this subtraction would work. When using a red filter, we expect the blue channel to record mostly near infrared light (NIR), and we expect the red channel to record lots of both red and NIR light. The subtraction idea is based on the concept that since we have a good measure of NIR light (blue channel) we can subtract that from the measure of red+NIR light (red channel) and approximate a measure of pure red light.

That concept involves the assumption that red light and NIR light are being recorded in comparable ways. Does the blue channel record NIR light the same way the red channel records NIR light? Does the blue channel record NIR light the same way the red channel records red light? For example, if you have two equally bright LEDs, one pure red and one pure NIR, illuminating a perfectly reflective surface, and you take an Infragram photo of the surface, will the brightness value recorded in the red channel be twice that recorded in the blue channel?

I think this is not going to be true very often. The relative brightness of those two channels is going to be strongly influenced by the white balance setting on the camera. The standard white balance setting for red filtered infragram cameras strongly exaggerates the brightness of the blue channel. It does that so the brightness of healthy foliage recorded in the blue channel is several times greater than the brightness in the red channel. This allows us to calculate some semblance of NDVI with the values in the photos straight from the camera. I think this protocol ensures that subtracting the value in the blue channel (NIR) from the value in the red channel (red + NIR) will produce a negative number, not an approximation of the brightness of red.

If a very different white balance setting is used, it might be reasonable to do the subtraction, but it might not offer any benefit over the current protocol.

If photos are recorded in RAW image format, then no adjustment is done to the relative brightness of the channels. So if more light gets through to the red channel than the blue channel, the difference in brightness will be faithfully recorded. In this situation, doing the subtraction could make sense. Ned’s calibration protocols rely on RAW images.

In order for the subtraction to produce the desired result (an approximation of the brightness of just red light), we still have to assume that NIR is being recorded equivalently in both the red and blue channels. This requires that the red and blue Bayer filters transmit similar amounts of NIR light. Every sensor is a little different in this respect, but generally more NIR seems to be recorded in the red channel versus the blue. So unless you can quantify the difference in channel sensitivity to NIR, the subtraction may not be a very precise way to approximate red, even when RAW image data is recorded. .
spectral-response-ccd.jpg
.
Ned’s calibration protocol involves putting targets of known spectral reflectivity into the photos. This allows him to know how much NIR is getting into each channel. Without this step, the subtraction may not get us any closer to the real value for red.

Chris

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

Reply to this comment...


Hi

I am trying to process two images in Fiji, one raw infrared, one visible spectrum. When choosing the two image files from which to create a text file the software completes the task but the resulting text file which should contain the path to the two images is blank. The files are independently stored in two different folder as described in the Fiji tutorial. I suspect it may be because I have downloaded these two images from the internet and the metadata has been stripped out. I don't yet have my IR camera up and running which is why I am using downloaded images.

Any help would be much appreciated.

Thank you.

edit: Apologies if this is in the wrong thread but it's the most relevant recent thread on this plugin I could find.

Reply to this comment...


Theo, I have gotten that error too, even when using my own pairs of simultaneous photos (I think the cameras' clocks were way off). I forget what I did, but for just a few pairs I often make the list of photo pairs by hand.

You can ask questions like this at the Public Lab infrared Google Group (https://groups.google.com/forum/#!forum/plots-infrared) or in this case you could add to or start an issue at Github: https://github.com/nedhorning/PhotoMonitoringPlugin/issues.
Chris

Reply to this comment...


Thanks for your reply Chris!

Reply to this comment...


Hello, I'm new to the organization...and NIR technology in general. I have played some with the Photo-monitoring plug in. Great too by the way! Is there a way to attach the geo-reference data from the original photo to the post-processed NDVI image automatically?

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

Reply to this comment...


At this time it is not possible to use geo-reference data. If there is sufficient interest in that functionality I could try to add it but it's not trivial for me since I'd need to include a library that would allow me to read and write the EXIF tags from a GeoTiff image.

Reply to this comment...


Thank you.

Reply to this comment...


Login to comment.