From fe96407e9e81285f18ae454624027877c9f02a3d Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 8 Dec 2020 11:37:25 -0500 Subject: [PATCH 1/3] Fix re-run logic --- stages/run_opensfm.py | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/stages/run_opensfm.py b/stages/run_opensfm.py index 84cdf2b4..dfb85ad9 100644 --- a/stages/run_opensfm.py +++ b/stages/run_opensfm.py @@ -147,22 +147,31 @@ class ODMOpenSfMStage(types.ODM_Stage): for band in reconstruction.multi_camera: nvm_file = octx.path("undistorted", "reconstruction_%s.nvm" % band['name'].lower()) - img_map = {} - for fname in p2s: + if not io.file_exists(nvm_file) or self.rerun(): + img_map = {} + + if primary_band_name is None: + primary_band_name = multispectral.get_primary_band_name(reconstruction.multi_camera, args.primary_band) + if p2s is None: + s2p, p2s = multispectral.compute_band_maps(reconstruction.multi_camera, primary_band_name) - # Primary band maps to itself - if band['name'] == primary_band_name: - img_map[fname + '.tif'] = fname + '.tif' - else: - band_filename = next((p.filename for p in p2s[fname] if p.band_name == band['name']), None) - - if band_filename is not None: - img_map[fname + '.tif'] = band_filename + '.tif' + for fname in p2s: + + # Primary band maps to itself + if band['name'] == primary_band_name: + img_map[fname + '.tif'] = fname + '.tif' else: - log.ODM_WARNING("Cannot find %s band equivalent for %s" % (band, fname)) + band_filename = next((p.filename for p in p2s[fname] if p.band_name == band['name']), None) - nvm.replace_nvm_images(tree.opensfm_reconstruction_nvm, img_map, nvm_file) + if band_filename is not None: + img_map[fname + '.tif'] = band_filename + '.tif' + else: + log.ODM_WARNING("Cannot find %s band equivalent for %s" % (band, fname)) + nvm.replace_nvm_images(tree.opensfm_reconstruction_nvm, img_map, nvm_file) + else: + log.ODM_WARNING("Found existing NVM file %s" % nvm_file) + self.update_progress(85) # Skip dense reconstruction if necessary and export From 671b4058ee4c10d11d34888f94a190dcca339d9d Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 8 Dec 2020 16:52:09 +0000 Subject: [PATCH 2/3] Bump --pc-quality parameters, set minimum cap --- opendm/config.py | 2 +- opendm/utils.py | 12 +++++++----- stages/openmvs.py | 1 - 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/opendm/config.py b/opendm/config.py index b7065ff8..75234fe6 100755 --- a/opendm/config.py +++ b/opendm/config.py @@ -370,7 +370,7 @@ def config(argv=None, parser=None): metavar='', action=StoreValue, default='medium', - choices=['ultra', 'high', 'medium', 'low'], + choices=['ultra', 'high', 'medium', 'low', 'lowest'], help=('Set point cloud quality. Higher quality generates better, denser point clouds, but requires more memory and takes longer. Each step up in quality increases processing time roughly by a factor of 4x.' 'Can be one of: %(choices)s. Default: ' '%(default)s')) diff --git a/opendm/utils.py b/opendm/utils.py index 42cc2c6d..4edd0860 100644 --- a/opendm/utils.py +++ b/opendm/utils.py @@ -8,16 +8,18 @@ def get_depthmap_resolution(args, photos): return int(args.depthmap_resolution) else: max_dim = find_largest_photo_dim(photos) + min_dim = 320 # Never go lower than this pc_quality_scale = { - 'ultra': 0.5, - 'high': 0.25, - 'medium': 0.125, - 'low': 0.0675 + 'ultra': 1, + 'high': 0.5, + 'medium': 0.25, + 'low': 0.125, + 'lowest': 0.0675 } if max_dim > 0: - return int(max_dim * pc_quality_scale[args.pc_quality]) + return max(min_dim, int(max_dim * pc_quality_scale[args.pc_quality])) else: log.ODM_WARNING("Cannot compute max image dimensions, going with default depthmap_resolution of 640") return 640 # Sensible default diff --git a/stages/openmvs.py b/stages/openmvs.py index fdddcdf9..c583831e 100644 --- a/stages/openmvs.py +++ b/stages/openmvs.py @@ -38,7 +38,6 @@ class ODMOpenMVSStage(types.ODM_Stage): os.mkdir(depthmaps_dir) depthmap_resolution = get_depthmap_resolution(args, photos) - if outputs["undist_image_max_size"] <= depthmap_resolution: resolution_level = 0 else: From 6c4c16b9f23658c41681b3b7d64e95106fad2a73 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 8 Dec 2020 11:53:59 -0500 Subject: [PATCH 3/3] Bump version --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 276cbf9e..2bf1c1cc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.3.0 +2.3.1