if (FALSE) {
# dontrun is to avoid forcing users to install additional dependencies
wd_images_OCR <- system.file("pictures/full_size_for_ocr", package = "camtrapR")
library(magick)
# define geometries
geometry1 <- geometry_area(x_off = 0, y_off = 0, width = 183, height = 37)
geometry2 <- geometry_area(x_off = 196, y_off = 0, width = 200, height = 17)
geometry3 <- geometry_area(x_off = 447, y_off = 0, width = 63, height = 17)
geometry4 <- geometry_area(x_off = 984, y_off = 0, width = 47, height = 17)
geometry5 <- geometry_area(x_off = 0, y_off = 793, width = 320, height = 17)
# combine geometries into list
geometries <- list(date = geometry1,
time = geometry2,
sequence_id = geometry3,
temperature = geometry4,
camera_model = geometry5)
df_image_data <- OCRdataFields(inDir = wd_images_OCR,
geometries = geometries,
invert = TRUE)
df_image_data
library(parallel)
library(lubridate)
# prepare DateTimeOriginal column (ymd_hms() automatically respects the PM indicator)
df_image_data$DateTimeOriginal <- paste(df_image_data$date, df_image_data$time)
df_image_data$DateTimeOriginal <- as.character(ymd_hms(df_image_data$DateTimeOriginal))
# create cluster (3 cores)
cl <- makeCluster(3)
# assign new DateTimeOriginal
writeDateTimeOriginal(DateTimeOriginal = df_image_data$DateTimeOriginal,
fileNames = df_image_data$filename_full,
parallel = cl)
stopCluster(cl)
}
Run the code above in your browser using DataLab