Skip to main content
added 1134 characters in body
Source Link
Perro
  • 339
  • 2
  • 18

One File Example

one.Image<-read_exif(path = "...")
one.Image

coordinate.one.Image<-read.csv("...", header = TRUE)
head(coordinate.one.Image)

exiftool_call(args = coordinate.one.Image, fnames = one.Image) 

Output str(coordinate.one.Image)

'data.frame':   1 obs. of  15 variables:
 $ meta.df.FileName           : Factor w/ 1 level "IMG_0001_1.tif": 1
 $ meta.df.FileInodeChangeDate: Factor w/ 1 level "2018:07:11 14:16:49-05:00": 1
 $ meta.df.BandName           : Factor w/ 1 level "Blue": 1
 $ coorMetric.lon             : num 329860
 $ coorMetric.lat             : num 4056981
 $ ImageWidth                 : num 88.8
 $ ImageHeight                : num 66.7
 $ TopLeftx                   : num 329815
 $ TopLefty                   : num 4057015
 $ TopRightx                  : num 329904
 $ TopRighty                  : num 4057015
 $ BottomLeftx                : num 329815
 $ BottomLefty                : num 4056948
 $ BottomRightx               : num 329904
 $ BottomRighty               : num 4056948

One File Example

one.Image<-read_exif(path = "...")
one.Image

coordinate.one.Image<-read.csv("...", header = TRUE)
head(coordinate.one.Image)

exiftool_call(args = coordinate.one.Image, fnames = one.Image) 

Output str(coordinate.one.Image)

'data.frame':   1 obs. of  15 variables:
 $ meta.df.FileName           : Factor w/ 1 level "IMG_0001_1.tif": 1
 $ meta.df.FileInodeChangeDate: Factor w/ 1 level "2018:07:11 14:16:49-05:00": 1
 $ meta.df.BandName           : Factor w/ 1 level "Blue": 1
 $ coorMetric.lon             : num 329860
 $ coorMetric.lat             : num 4056981
 $ ImageWidth                 : num 88.8
 $ ImageHeight                : num 66.7
 $ TopLeftx                   : num 329815
 $ TopLefty                   : num 4057015
 $ TopRightx                  : num 329904
 $ TopRighty                  : num 4057015
 $ BottomLeftx                : num 329815
 $ BottomLefty                : num 4056948
 $ BottomRightx               : num 329904
 $ BottomRighty               : num 4056948
Source Link
Perro
  • 339
  • 2
  • 18

Write information on file using exiftool_call in R

I have a series of images (.tiff) that are only georeference at the true centroid of the picture. I have calculated the missing coordinates (top right, top left, bottom right and bottom left) in the X and Y plain, and now I will like to write those coordinates in each image.

In order to do that, I was told that the exifr package in R has a function call exiftool_call that could be helpful to complete that task. I have tried different things, but they don't seem to be working, so I was wondering if anyone knows how to accomplish this task using exiftool_call

Here is what I have tried so far:

coordinates.data<-read.csv("...",header=TRUE)

list.pics <- list.files(path ="...",pattern = "*.tif",full.names = TRUE)
 
exiftool_call(args = coordinates.data, fnames = list.pics)  

exiftool_call(args = c(coordinates.data$TopLeftx,coordinates.data$TopLefty,coordinates.data$TopRightx,
                      coordinates.data$TopRighty,coordinates.data$BottomLeftx,coordinates.data$BottomLefty,
                      coordinates.data$BottomRightx,coordinates.data$BottomRighty),fnames = list.pics)

exiftool_call(args = c("coordinates.data$TopLeftx","coordinates.data$TopLefty","coordinates.data$TopRightx",
                       "coordinates.data$TopRighty","coordinates.data$BottomLeftx","coordinates.data$BottomLefty",
                       "coordinates.data$BottomRightx","coordinates.data$BottomRighty"),fnames = list.pics)

Output str(coordinates.data)

'data.frame':   5 obs. of  16 variables:
 $ X                          : int  1 2 3 4 5
 $ meta.df.FileName           : Factor w/ 5 levels "IMG_0000_1.tif",..: 1 2 3 4 5
 $ meta.df.FileInodeChangeDate: Factor w/ 3 levels "2018:07:11 14:16:48-05:00",..: 1 3 1 2 2
 $ meta.df.BandName           : Factor w/ 5 levels "Blue","Green",..: 1 2 4 3 5
 $ coorMetric.lon             : num  329878 329878 329878 329878 329878
 $ coorMetric.lat             : num  4057023 4057023 4057023 4057023 4057023
 $ ImageWidth                 : num  88.8 88.8 88.8 88.8 88.8
 $ ImageHeight                : num  66.7 66.7 66.7 66.7 66.7
 $ TopLeftx                   : num  329833 329833 329833 329833 329833
 $ TopLefty                   : num  4057056 4057056 4057056 4057056 4057056
 $ TopRightx                  : num  329922 329922 329922 329922 329922
 $ TopRighty                  : num  4057056 4057056 4057056 4057056 4057056
 $ BottomLeftx                : num  329833 329833 329833 329833 329833
 $ BottomLefty                : num  4056989 4056989 4056989 4056989 4056989
 $ BottomRightx               : num  329922 329922 329922 329922 329922
 $ BottomRighty        

   : num  4056989 4056989 4056989 4056989 4056989