From 5840450d0fe8992d4514c3a2499682ad7e2e8217 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 17 Nov 2020 09:32:14 -0500 Subject: [PATCH] More robust EXIF parsing --- SuperBuild/cmake/External-OpenSfM.cmake | 2 +- opendm/photo.py | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/SuperBuild/cmake/External-OpenSfM.cmake b/SuperBuild/cmake/External-OpenSfM.cmake index be03be63..850822dd 100644 --- a/SuperBuild/cmake/External-OpenSfM.cmake +++ b/SuperBuild/cmake/External-OpenSfM.cmake @@ -9,7 +9,7 @@ ExternalProject_Add(${_proj_name} #--Download step-------------- DOWNLOAD_DIR ${SB_DOWNLOAD_DIR} GIT_REPOSITORY https://github.com/OpenDroneMap/OpenSfM/ - GIT_TAG 211 + GIT_TAG 221 #--Update/Patch step---------- UPDATE_COMMAND git submodule update --init --recursive #--Configure step------------- diff --git a/opendm/photo.py b/opendm/photo.py index cd99bb4f..984e729f 100644 --- a/opendm/photo.py +++ b/opendm/photo.py @@ -315,18 +315,19 @@ class ODM_Photo: def dms_to_decimal(self, dms, sign): """Converts dms coords to decimal degrees""" degrees, minutes, seconds = self.float_values(dms) - - return (-1 if sign.values[0] in 'SWsw' else 1) * ( - degrees + - minutes / 60 + - seconds / 3600 - ) + + if degrees is not None and minutes is not None and seconds is not None: + return (-1 if sign.values[0] in 'SWsw' else 1) * ( + degrees + + minutes / 60 + + seconds / 3600 + ) def float_values(self, tag): if isinstance(tag.values, list): - return [float(v.num) / float(v.den) for v in tag.values] + return [float(v.num) / float(v.den) if v.den != 0 else None for v in tag.values] else: - return [float(tag.values.num) / float(tag.values.den)] + return [float(tag.values.num) / float(tag.values.den) if tag.values.den != 0 else None] def float_value(self, tag): v = self.float_values(tag)