forked from xime377/RedEdge-calibration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3.Exposure compensation.R
41 lines (29 loc) · 1.18 KB
/
3.Exposure compensation.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#Set WD
#setwd("H:/Ximena/MSc Thesis/Results")
setwd("D:/Google Drive/MSc Thesis/Results")
###Load libraries
#library(pacman)
#pacman::p_load(agricolae, Rmisc) To install several packages at the same time
library(raster)
#Load functions
source("./lib/Exposure.Compensation.R")
#Load Exif
exif<-read.csv("./UAV imagery/Lonnstorp/2017_04_08/Micasense/Flight_2/000/2017_04_08_2_Lonnstorp_EXIF.csv", header=T)
head(exif)
#Load images
T.img.path<- list.files(path=("./UAV imagery/Lonnstorp/2017_04_08/Micasense/Flight_2/000"), (pattern=".tif$"),
full.names=T) #List images
T.img<- lapply(T.img.path,raster) #Load all bands
names(T.img)<-T.img.path
#Individual test
#z=EC(T.img[[1]],exif$FNumber[1],exif$ExposureTime[1],exif$ISOSpeed[1])
#Exposure compensation
for (i in 1:length(T.img))
{
T.img[[i]]<-EC(T.img[[i]],exif$FNumber[i],exif$ExposureTime[i],exif$ISOSpeed[i])
writeRaster(T.img[[i]],paste0("./UAV imagery/Lonnstorp/2017_04_08/Micasense/Flight_2/EC/",
substr(names(T.img[i]),59,68),".tif"), datatype="INT2U",
options="COMPRESS=NONE", overwrite=T)
}
##End
######