
timeShiftImages (inDir,
timeShiftTable,
stationCol,
cameraCol,
hasCameraSubfolders,
timeShiftColumn,
timeShiftSignColumn,
undo = FALSE
)
timeShiftTable
timeShiftTable
(optional)timeShiftTable
timeShiftTable
. Can only be "-" or "+".TRUE
data.frame
containing the information about the processed directories and the number of images.timeShiftTable
is a data frame with columns for station ID, camera ID (optional), time shift value and direction of time shift.
Images in inDir
are expected to be sorted into station directories. If hasCameraSubfolders = TRUE
, the function will look for camera subdirectories of the station directories and only apply time shifts to the camera subdirectories specified by CameraCol
in timeShiftTable
. If hasCameraSubfolders = FALSE
, shifts will be applied to the whole station directory (including potential subdirectories).
The values of timeShiftColumn
should adhere to the following pattern: "Y:M:D H:M:S", i.e. "1:0:0 0:0:0" is a shift of exactly 1 year and "0:0:0 12:10:01" 12 hours and 10 minutes and 1 second. timeShiftSignColumn
signifies the direction of the time shift. "+" moves image dates into the future (i.e. the image date lagged behind the actual date) and "-" moves image dates back (if the image dates were ahead of actual time).
Exiftool stores the original images as .JPG_original
files in the original file location. By setting undo = TRUE
, any JPG files in the directories specified by timeShiftTable
will be deleted and the original JPEGs will be restored from the JPG_original files. Please make a backup before using undo
.# copy sample images to another location (so we don't mess around in the package directory)
wd_images_ID <- system.file("pictures/sample_images", package = "camtrapR")
file.copy(from = wd_images_ID, to = getwd(), recursive = TRUE)
wd_images_ID_copy <- paste(getwd(), "sample_images", sep = "/")
data(timeShiftTable)
timeshift_run <- timeShiftImages(inDir = wd_images_ID_copy,
timeShiftTable = timeShiftTable,
stationCol = "Station",
hasCameraSubfolders = FALSE,
timeShiftColumn = "timeshift",
timeShiftSignColumn = "sign",
undo = FALSE
)
timeshift_undo <- timeShiftImages(inDir = wd_images_ID_copy,
timeShiftTable = timeShiftTable,
stationCol = "Station",
hasCameraSubfolders = FALSE,
timeShiftColumn = "timeshift",
timeShiftSignColumn = "sign",
undo = TRUE
)
Run the code above in your browser using DataLab