forked from xime377/RedEdge-calibration
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImport EXIF cal targets.R
184 lines (122 loc) · 9.39 KB
/
Import EXIF cal targets.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
#Set WD
#setwd("H:/Ximena/MSc Thesis/Results")
setwd("D:/Google Drive/MSc Thesis/Results")
###Load libraries
library(exifr) #On windowsit is needed to install strawberry http://strawberryperl.com/
#Load imgs
T.img.path1 <- list.files(path=("./Calibration/Cal_pics/2017_03_24/1/"), (pattern="0008.*.tif$"),
full.names=T) #9%
T.img.path2 <- list.files(path=("./Calibration/Cal_pics/2017_03_24/2/"), (pattern="0004.*.tif$"),
full.names=T) #9
T.img.path3 <- list.files(path=("./Calibration/Cal_pics/2017_04_08/1/"), (pattern="0145.*.tif$"),
full.names=T) #9%
T.img.path4 <- list.files(path=("./Calibration/Cal_pics/2017_04_08/2/"), (pattern="0147.*.tif$"),
full.names=T) #9%
T.img.path5 <- list.files(path=("./Calibration/Cal_pics/2017_04_08/2/"), (pattern="0148.*.tif$"),
full.names=T) #9%
T.img.path6 <- list.files(path=("./Calibration/Cal_pics/2017_03_24/1/"), (pattern="0009.*.tif$"),
full.names=T) #23%
T.img.path7 <- list.files(path=("./Calibration/Cal_pics/2017_03_24/2/"), (pattern="0005.*.tif$"),
full.names=T) #23
T.img.path8 <- list.files(path=("./Calibration/Cal_pics/2017_04_08/1/"), (pattern="0146.*.tif$"),
full.names=T) #23%
T.img.path9 <- list.files(path=("./Calibration/Cal_pics/2017_04_08/2/"), (pattern="0145.*.tif$"),
full.names=T) #23%
T.img.path10 <- list.files(path=("./Calibration/Cal_pics/2017_04_08/2/"), (pattern="0146.*.tif$"),
full.names=T) #23%
T.img.path11 <- list.files(path=("./Calibration/Cal_pics/2017_03_24/1/"), (pattern="0007.*.tif$"),
full.names=T) #44%
T.img.path12 <- list.files(path=("./Calibration/Cal_pics/2017_03_24/2/"), (pattern="0003.*.tif$"),
full.names=T) #44
T.img.path13 <- list.files(path=("./Calibration/Cal_pics/2017_04_08/1/"), (pattern="0147.*.tif$"),
full.names=T) #44%
T.img.path14 <- list.files(path=("./Calibration/Cal_pics/2017_04_08/2/"), (pattern="0143.*.tif$"),
full.names=T) #44%
T.img.path15<- list.files(path=("./Calibration/Cal_pics/2017_04_08/2/"), (pattern="0144.*.tif$"),
full.names=T) #44%
T.img.path16 <- list.files(path=("./Calibration/Cal_pics/2016_08_12/"), (pattern="0001.*.tif$"),
full.names=T) #RP02-...282 ->50%
T.img.path17 <- list.files(path=("./Calibration/Cal_pics/2016_08_12/"), (pattern="0116.*.tif$"),
full.names=T) #RP02-...282 ->50%
T.img.path18 <- list.files(path=("./Calibration/Cal_pics/2016_08_12/"), (pattern="0122.*.tif$"),
full.names=T) #RP02-...282 ->50%
T.img.path19 <- list.files(path=("./Calibration/Cal_pics/2017_03_07/1/before/"), (pattern="0000.*.tif$"),
full.names=T) #RP02-...282 ->50%
T.img.path20 <- list.files(path=("./Calibration/Cal_pics/2017_03_07/1/after/"), (pattern="0000.*.tif$"),
full.names=T) #RP02-...282 ->50%
T.img.path21 <- list.files(path=("./Calibration/Cal_pics/2017_03_07/2/"), (pattern="0002.*.tif$"),
full.names=T) #RP02-...282 ->50%
T.img.path22 <- list.files(path=("./Calibration/Cal_pics/2017_03_07/2/"), (pattern="0003.*.tif$"),
full.names=T) #RP02-...282 ->50%
T.img.path23 <- list.files(path=("./Calibration/Cal_pics/2017_03_07/2/"), (pattern="0007.*.tif$"),
full.names=T) #RP02-...282 ->50%
T.img.path24 <- list.files(path=("./Calibration/Cal_pics/2017_03_07/2/"), (pattern="0008.*.tif$"),
full.names=T) #RP02-...282 ->50%
T.img.path25 <- list.files(path=("./Calibration/Cal_pics/2017_03_24/1/"), (pattern="0000.*.tif$"),
full.names=T) #RP02-...282 ->50%
T.img.path26 <- list.files(path=("./Calibration/Cal_pics/2017_03_24/2/"), (pattern="0001.*.tif$"),
full.names=T) #RP02-...282 ->50%
T.img.path27 <- list.files(path=("./Calibration/Cal_pics/2017_03_24/2/"), (pattern="0002.*.tif$"),
full.names=T) #RP02-...282 ->50%
T.img.path28 <- list.files(path=("./Calibration/Cal_pics/2017_04_08/1/"), (pattern="0141.*.tif$"),
full.names=T) #RP02-...282 ->50%
T.img.path29 <- list.files(path=("./Calibration/Cal_pics/2017_04_08/1/"), (pattern="0142.*.tif$"),
full.names=T) #RP02-...282 ->50%
T.img.path30 <- list.files(path=("./Calibration/Cal_pics/2017_04_08/2/"), (pattern="0141.*.tif$"),
full.names=T) #RP02-...282 ->50%
T.img.path31 <- list.files(path=("./Calibration/Cal_pics/2016_08_12/"), (pattern="0123.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path32 <- list.files(path=("./Calibration/Cal_pics/2016_11_03/1/"), (pattern="0000.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path33 <- list.files(path=("./Calibration/Cal_pics/2016_11_03/1/"), (pattern="0001.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path34 <- list.files(path=("./Calibration/Cal_pics/2016_11_03/1/"), (pattern="0004.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path35 <- list.files(path=("./Calibration/Cal_pics/2016_11_03/1/"), (pattern="0005.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path36 <- list.files(path=("./Calibration/Cal_pics/2016_11_03/2/"), (pattern="0000.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path37 <- list.files(path=("./Calibration/Cal_pics/2016_11_03/2/"), (pattern="0002.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path38 <- list.files(path=("./Calibration/Cal_pics/2016_12_02/"), (pattern="0000.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path39 <- list.files(path=("./Calibration/Cal_pics/2016_12_02/"), (pattern="0002.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path40 <- list.files(path=("./Calibration/Cal_pics/2017_03_07/1/after/"), (pattern="0001.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path41 <- list.files(path=("./Calibration/Cal_pics/2017_03_07/1/before/"), (pattern="0001.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path42 <- list.files(path=("./Calibration/Cal_pics/2017_03_07/2/"), (pattern="0000.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path43 <- list.files(path=("./Calibration/Cal_pics/2017_03_07/2/"), (pattern="0001.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path44 <- list.files(path=("./Calibration/Cal_pics/2017_03_07/2/"), (pattern="0005.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path45 <- list.files(path=("./Calibration/Cal_pics/2017_03_07/2/"), (pattern="0006.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path46 <- list.files(path=("./Calibration/Cal_pics/2017_03_24/1/"), (pattern="0001.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path47 <- list.files(path=("./Calibration/Cal_pics/2017_03_24/1/"), (pattern="0006.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path48 <- list.files(path=("./Calibration/Cal_pics/2017_03_24/2/"), (pattern="0000.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path49 <- list.files(path=("./Calibration/Cal_pics/2017_03_24/2/"), (pattern="0000.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path50 <- list.files(path=("./Calibration/Cal_pics/2017_04_08/1/"), (pattern="0143.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path51 <- list.files(path=("./Calibration/Cal_pics/2017_04_08/1/"), (pattern="0144.*.tif$"),
full.names=T) #RP02-...200 ->80%
T.img.path52 <- list.files(path=("./Calibration/Cal_pics/2017_04_08/2/"), (pattern="0142.*.tif$"),
full.names=T) #RP02-...200 ->80%
#Group all the images in one list
L.img<-ls(pattern="path")
T.img<-lapply(L.img,get)
names(T.img)<-L.img
#Extract exif
for (i in 1:length(T.img)){
T.img[[i]] <- exifr(T.img[[i]], exiftoolargs="-filename -DateTimeOriginal -FOV -CentralWavelength -Irradiance -IrradianceExposureTime
-IrradianceGain -IrradiancePitch -IrradianceRoll -IrradianceYaw -Pitch -Roll -Yaw -BlackLevelRepeatDim
-Aperture -ShutterSpeed -ISOspeed -Fnumber -ExposureTime -SpectralIrradiance -WavelengthFWHM -FocalLength35efl
-ScaleFactor35efl -Gain -BandSensitivity")
write.csv(T.img[[i]], paste0("./Calibration/Cal_pics/EC/", substr(names(T.img[i]),59,68),".csv")) #Export data as .csv
}