Warn if images have likely invalid GPS position

pull/1434/head
Piero Toffanin 2022-03-11 13:43:58 -05:00
rodzic 8e86daae9d
commit a4ef8a9f2b
1 zmienionych plików z 8 dodań i 3 usunięć

Wyświetl plik

@ -214,7 +214,7 @@ class ODM_Photo:
if 'Image Orientation' in tags:
self.orientation = self.int_value(tags['Image Orientation'])
except (IndexError, ValueError) as e:
log.ODM_WARNING("Cannot read basic EXIF tags for %s: %s" % (_path_file, str(e)))
log.ODM_WARNING("Cannot read basic EXIF tags for %s: %s" % (self.filename, str(e)))
try:
if 'Image Tag 0xC61A' in tags:
@ -256,7 +256,12 @@ class ODM_Photo:
epoch = timezone.localize(datetime.utcfromtimestamp(0))
self.utc_time = (timezone.localize(utc_time) - epoch).total_seconds() * 1000.0
except Exception as e:
log.ODM_WARNING("Cannot read extended EXIF tags for %s: %s" % (_path_file, str(e)))
log.ODM_WARNING("Cannot read extended EXIF tags for %s: %s" % (self.filename, str(e)))
# Warn if GPS coordinates are suspiciously wrong
if self.latitude is not None and self.latitude == 0 and \
self.longitude is not None and self.longitude == 0:
log.ODM_WARNING("%s has GPS position (0,0), possibly corrupted" % self.filename)
# Extract XMP tags
@ -381,7 +386,7 @@ class ODM_Photo:
self.roll *= -1
except Exception as e:
log.ODM_WARNING("Cannot read XMP tags for %s: %s" % (_path_file, str(e)))
log.ODM_WARNING("Cannot read XMP tags for %s: %s" % (self.filename, str(e)))
# self.set_attr_from_xmp_tag('center_wavelength', xtags, [
# 'Camera:CentralWavelength'