Lab11 – MicaSense RedEdge-M – Follow-up

Lab 11 RedEdge – Follow-up

 

We’ve just flown a RedEdge mission out at Lake Herrick resulting in 275, 5-band multispectral images.  Many of the images were acquired using a vertical flight pattern (5m AGL, 6m AGL, …, 200m AGL).

The raw imagery has been converted to percent reflectance (DN to Reflectance) using Micasense’s imageprocessing python libraries that can be downloaded here: https://github.com/micasense/imageprocessing.  The individual images that comprise each image capture, however, have not been aligned.  Recall that the RedEdge-M is a multi-lens camera that produces a single image capture consisting of five individual images and the images are slightly offset due to the sensor’s multiple lenses.  Alignment must be performed before the images can be analyzed.


Manual Fiji/ImageJ approach you followed in lab Monday…

You will be using the “Register Virtual Stack Slices” plugin (Plugins>Registration>Register Virtual Stack Slices) to align each image capture (ie bands 1 – 5 for image 0114; 0114_1, 0114_2, 0114_3, 0114_4, 0114_5). Your steps are:

  1. create a new folder for each image capture and copy the respective images over
    • create folders dn_114, dn_115, refl_114, refl_115
    • copy the image captures to the appropriate folder (5 individual images)
  1. create a new folder for each aligned image capture
    • create folders out_dn_114, out_dn_115, out_refl_114, out_refl_115
  2. run the Register Virtual Stack Slices for each capture (see Screenshots below)
    • Screen1: specify your input and output folders
    • Screen2: select your reference image; this is the image to which the other four images will be referenced
  3. quit and restart Fiji to clear memory before processing the next image

Lets look for opportunities to automate the process… In R!!!!!!!

  1. create folders and copy files…
    • create a list of files; store the name of only the band 1 images from each image capture (*_1.tif), copy (*_<1-5>.tif) to their appropriate folders.
  2. create output folders
workDir<- "F:/uav/LakeHerrick_12Mar19/RedEdge/0000SET/all_flights/flight04082019/refl/0000SET/000"
setwd(workDir)
#####Step 1
#####store *_1.tif file names
fileList<- list.files(path=workDir, pattern = '*_1.tif', full.names = FALSE)
print(fileList)
#####remove the ".tif" from each entry in fileList
#####gsub command searches for "_1.tif" in each fileList entry and replaces it with "")
folderList<- gsub("_1.tif","",fileList)
print(folderList)
#####create directories, one for each entry in folderList
#####careful, this creates one folder for each entry in the folderList
lapply(folderList, function(x) if(!dir.exists(x)) dir.create(x))
#####copy the five individual images of each image capture to their appropriate folders
#####the following for loop is a lazy implementation; lapply or sapply would be more appropriate
for(x in folderList) {
  file.copy(paste(x , "_1.tif", sep=''),x)
  file.copy(paste(x , "_2.tif", sep=''),x)
  file.copy(paste(x , "_3.tif", sep=''),x)
  file.copy(paste(x , "_4.tif", sep=''),x)
  file.copy(paste(x , "_5.tif", sep=''),x)
}
#####Step 2, create output folders
for(x in folderList) {
 tx<- paste("out_",x,sep='')
 if(!dir.exists(tx)) {
  dir.create(tx,x)
 }
}

Fiji/ImageJ does have batch processing capabilities, however there are issues with batching the Register Virtual Stack Slices.  Alex Herbert has compiles an excellent tutorial, ImageJ Batch Processing document (http://www.sussex.ac.uk/gdsc/intranet/pdfs/ImageJBatchProcessing.pdf), covering these capabilities.