Handle images without GPSLatitudeRef, GPSLongitudeRef

pull/1464/head
Piero Toffanin 2022-05-26 14:03:42 -04:00
rodzic 732205910b
commit 9d4fcda5a4
3 zmienionych plików z 16 dodań i 22 usunięć

Wyświetl plik

@ -401,21 +401,6 @@ def config(argv=None, parser=None):
help='Improve the accuracy of the point cloud by computing geometrically consistent depthmaps. This increases processing time, but can improve results in urban scenes. '
'Default: %(default)s')
parser.add_argument('--pc-sharp',
action=StoreTrue,
nargs=0,
default=False,
help='Improve the accuracy of the point cloud by applying filters to sharpen the pointcloud, but reduces the completeness of the reconstruction. '
'Default: %(default)s')
parser.add_argument('--pc-subreslevel',
metavar='<positive integer>',
action=StoreValue,
default=2,
type=int,
help=('The number of lower resolutions to process before estimating output resolution depthmap. '
'Default: %(default)s'))
parser.add_argument('--smrf-scalar',
metavar='<positive float>',
action=StoreValue,

Wyświetl plik

@ -81,6 +81,11 @@ def get_mm_per_unit(resolution_unit):
class PhotoCorruptedException(Exception):
pass
class GPSRefMock:
def __init__(self, ref):
self.values = [ref]
class ODM_Photo:
"""ODMPhoto - a class for ODMPhotos"""
@ -209,8 +214,14 @@ class ODM_Photo:
self.altitude *= -1
if 'GPS GPSLatitude' in tags and 'GPS GPSLatitudeRef' in tags:
self.latitude = self.dms_to_decimal(tags['GPS GPSLatitude'], tags['GPS GPSLatitudeRef'])
elif 'GPS GPSLatitude' in tags:
log.ODM_WARNING("GPS position for %s might be incorrect, GPSLatitudeRef tag is missing (assuming N)" % self.filename)
self.latitude = self.dms_to_decimal(tags['GPS GPSLatitude'], GPSRefMock('N'))
if 'GPS GPSLongitude' in tags and 'GPS GPSLongitudeRef' in tags:
self.longitude = self.dms_to_decimal(tags['GPS GPSLongitude'], tags['GPS GPSLongitudeRef'])
elif 'GPS GPSLongitude' in tags:
log.ODM_WARNING("GPS position for %s might be incorrect, GPSLongitudeRef tag is missing (assuming E)" % self.filename)
self.longitude = self.dms_to_decimal(tags['GPS GPSLongitude'], GPSRefMock('E'))
if 'Image Orientation' in tags:
self.orientation = self.int_value(tags['Image Orientation'])
except (IndexError, ValueError) as e:

Wyświetl plik

@ -60,6 +60,7 @@ class ODMOpenMVSStage(types.ODM_Stage):
log.ODM_INFO("Estimating depthmaps")
number_views_fuse = 2
densify_ini_file = os.path.join(tree.openmvs, 'Densify.ini')
subres_levels = 2 # The number of lower resolutions to process before estimating output resolution depthmap.
config = [
" --resolution-level %s" % int(resolution_level),
@ -68,7 +69,7 @@ class ODMOpenMVSStage(types.ODM_Stage):
"--max-resolution %s" % int(outputs['undist_image_max_size']),
"--max-threads %s" % args.max_concurrency,
"--number-views-fuse %s" % number_views_fuse,
"--sub-resolution-levels %s" % args.pc_subreslevel,
"--sub-resolution-levels %s" % subres_levels,
'-w "%s"' % depthmaps_dir,
"-v 0"
]
@ -84,12 +85,9 @@ class ODMOpenMVSStage(types.ODM_Stage):
if not args.pc_geometric:
config.append("--geometric-iters 0")
if args.pc_sharp:
with open(densify_ini_file, 'w+') as f:
f.write("Optimize = 7\n")
else:
with open(densify_ini_file, 'w+') as f:
f.write("Optimize = 3\n")
sharp = args.pc_filter > 0
with open(densify_ini_file, 'w+') as f:
f.write("Optimize = %s\n" % (7 if sharp else 3))
def run_densify():
system.run('"%s" "%s" %s' % (context.omvs_densify_path,