This is another in the series of wonk-blogs; if you aren’t interested in the messy details of processing aerial images you might want to move along. But if you are, perhaps this post could save you some time.
Ned Horning has built a fantastic ImageJ (and Fiji) plugin to create NDVI images from a camera with the near IR filter removed (see a previous blog post for details on the camera conversion). The only downside is that ImageJ strips the time stamp from the EXIF metadata of the JPEG file – and we’re going to need that later when we go to geotag the image (I’ll have a future post on this process). Fortunately, there is another bit of open-source software to the rescue: ExifTool developed by Phil Harvey. As the name implies, this tool is the Swiss Army Knife for EXIF metadata. But right now we are only interested in one function: moving the time stamp from one JPEG to another. That is, we’re going to take the time stamp from the original file that came off the camera and shift it to the NDVI image. The syntax is:
exiftool –tagsFromFile originalfile.jpg NDVI_file.jpg
(thanks to archaeometallurgy.de for turning me on to this trick).
Since there are hundreds of photos, doing this by hand would get old pretty quick. On the Mac, exiftool operates from the command line of the Terminal. Normally I hate command line stuff, but the Terminal does allow for bash scripts to be executed. Here’s the drill.
1. In any text editor (Nano from the Terminal is the simplest), create this script (I called mine “exiftagger”);
#This script copies&nbsp; the EXIF header from one file to another
for ((c=431; c<=600; c++))
exiftool -tagsFromFile IMG_0"$c".jpg IMG_0"$c"_NDVI_Color.jpg
In this case my camera IMG files started with 0431 and ended in 0600 – clearly you would just replace the number in the “for” command with the appropriate numbers from your shooting session. “_NDVI_Color” is the bit that Ned Horning’s plugin adds to the file name.
Next, you need to make this script file executable. Simply type:
chmod +x exiftagger
Finally, run it from the command line with this command:
This was the first bash script I’ve ever written, but it worked flawlessly – hopefully you can do the same. Sorry I can’t provide any direct recipes for Windows but the scripting must be similar. And exiftool has versions for Windows, OSX, and Linux.