Open CSV file only once.
This commit is contained in:
parent
849d08060f
commit
16bb735b29
20
exif_rad.py
20
exif_rad.py
@ -33,19 +33,19 @@ parser.add_argument('photos', metavar='Photo', type=str, nargs='+',
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
for photo in args.photos:
|
||||
# Load Image and EXIF data
|
||||
im = Image.open(photo)
|
||||
exif_dict = piexif.load(im.info["exif"])
|
||||
# Import GeigerCounter log
|
||||
with open(args.csv, "r") as f:
|
||||
csvreader = csv.reader(filter(lambda row: row[0]!='#', f), delimiter=',', skipinitialspace=True)
|
||||
|
||||
picrawtime = exif_dict["Exif"][piexif.ExifIFD.DateTimeOriginal].decode('ASCII')
|
||||
picisotime = datetime.strptime(picrawtime, "%Y:%m:%d %H:%M:%S")
|
||||
for photo in args.photos:
|
||||
# Load Image and EXIF data
|
||||
im = Image.open(photo)
|
||||
exif_dict = piexif.load(im.info["exif"])
|
||||
|
||||
print("Timestamp of image: ", picisotime)
|
||||
picrawtime = exif_dict["Exif"][piexif.ExifIFD.DateTimeOriginal].decode('ASCII')
|
||||
picisotime = datetime.strptime(picrawtime, "%Y:%m:%d %H:%M:%S")
|
||||
|
||||
# Import GeigerCounter log
|
||||
with open("testdata/test.hisdb.his", "r") as f:
|
||||
csvreader = csv.reader(filter(lambda row: row[0]!='#', f), delimiter=',', skipinitialspace=True)
|
||||
print("Timestamp of image: ", picisotime)
|
||||
for _, csvrawtime, csvrawcpm, _ in csvreader:
|
||||
csvisotime = datetime.fromisoformat(csvrawtime)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user