Sorry, if i'm too verbose, but this is my first issue writing and i've work on it for a solution for a couple of days.
Flir equipment provide files named as typical concatenation code like: FLIR_yyyymmdd_hhmmss_3digitmillisecond.jpg
In order to facilitate picture classification, i'll export file list into an excel file that anybody could edit and than re import.
Here first Issue: averageFLIR is empty probably due to file name and photo name do not correspond. batch_extract delete "FLIR" and ".jpg" extension.
Workaround for this issue
Second Issue: "averageFLIRstack" is empty and were generated sob error
"Error in x[[1]] : subscript out of bounds"
I've found that in vignette, provided example show that metadata$photo_no is an integer class, while i'm not able to coerce to integer file name. Even if i'll will guess how to do it, then filename is no longer equal to photo_name in flir_file_list2
Workaround for this issue
Renaming all files with a short number names (like collapsing time parts in 9characters long filename) and restarting over the whole process.
It run successifully
`flir_file_list2 <- read_excel(paste0(folder_output,"//FLIR_fileNUMBER_NAME.xlsx"))
flir_file_list2<-as.data.frame(flir_file_list2)
flir_rawPICS<-batch_extract(in_dir=folder_input,
write_results=TRUE,
file_name = paste0("flir_converted_",Sys.Date()),
inc=flir_file_list,
out_dir=folder_output,
exiftoolpath="D:/AgriSearchInnovations/Comuni/termocamera/Exiftools/")
flir_converted<-batch_convert(flir_rawPICS$raw_dat,
E = 0.98,
OD = flir_file_list2$object_distance[PIC_index],
RTemp = flir_file_list2$ambient_temp[PIC_index],
ATemp = flir_file_list2$ambient_temp[PIC_index],
IRWTemp = flir_file_list2$ambient_temp[PIC_index],
IRT = 1,
RH = flir_file_list2$ambient_humidity[PIC_index],
PR1 = flir_rawPICS$camera_params$PlanckR1,
PB = flir_rawPICS$camera_params$PlanckB,
PF = flir_rawPICS$camera_params$PlanckF,
PO = flir_rawPICS$camera_params$PlanckO,
PR2 = flir_rawPICS$camera_params$PlanckR2,
write_results = TRUE,
out_dir = folder_output,
file_name = paste0("flir_converted_",Sys.Date())
)`
In order to eliminate residual "." and convert into integer field
`flir_file_list2$photo_name<-paste0(substr(flir_file_list2$photo_name,1,9))
flir_file_list2$photo_name<-as.numeric(flir_file_list2$photo_name)
flir_file_list2$photo_name<-as.integer(flir_file_list2$photo_name)
averageFLIR<-average_by_group(metadata = flir_file_list2,
img_list =flir_converted,
id = "photo_name",
grouping_var = "spatial_rep",
round_val = 4)
stackFLIR<-stack_imgs(flir_converted)
averageFLIRstack<-average_by_group(metadata = flir_file_list2,
img_list =stackFLIR,
id = "photo_name",
grouping_var = "spatial_rep",
round_val = 4)
raster::plot(averageFLIRstack)
`
Output graph is here attached
Is possible to generally work around these issue keeping indipendentely from coercing filename to integer??
Sorry, if i'm too verbose, but this is my first issue writing and i've work on it for a solution for a couple of days. Flir equipment provide files named as typical concatenation code like: FLIR_yyyymmdd_hhmmss_3digitmillisecond.jpg In order to facilitate picture classification, i'll export file list into an excel file that anybody could edit and than re import.
Here first Issue: averageFLIR is empty probably due to file name and photo name do not correspond. batch_extract delete "FLIR" and ".jpg" extension. Workaround for this issue
After this could proceed coercing matrix list to raster stack
stackFLIR<-stack_imgs(flir_converted)
..and averaging raster stackSecond Issue: "averageFLIRstack" is empty and were generated sob error "Error in x[[1]] : subscript out of bounds" I've found that in vignette, provided example show that metadata$photo_no is an integer class, while i'm not able to coerce to integer file name. Even if i'll will guess how to do it, then filename is no longer equal to photo_name in flir_file_list2 Workaround for this issue Renaming all files with a short number names (like collapsing time parts in 9characters long filename) and restarting over the whole process. It run successifully
` Output graph is here attached Is possible to generally work around these issue keeping indipendentely from coercing filename to integer??