Skip to content

Commit 84ff352

Browse files
authored
Merge pull request #1215 from pierotofy/231
Re-run bug fix, --pc-quality changes
2 parents 050a7ff + 6c4c16b commit 84ff352

File tree

5 files changed

+30
-20
lines changed

5 files changed

+30
-20
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0
1+
2.3.1

opendm/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ def config(argv=None, parser=None):
370370
metavar='<string>',
371371
action=StoreValue,
372372
default='medium',
373-
choices=['ultra', 'high', 'medium', 'low'],
373+
choices=['ultra', 'high', 'medium', 'low', 'lowest'],
374374
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.'
375375
'Can be one of: %(choices)s. Default: '
376376
'%(default)s'))

opendm/utils.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,18 @@ def get_depthmap_resolution(args, photos):
88
return int(args.depthmap_resolution)
99
else:
1010
max_dim = find_largest_photo_dim(photos)
11+
min_dim = 320 # Never go lower than this
1112

1213
pc_quality_scale = {
13-
'ultra': 0.5,
14-
'high': 0.25,
15-
'medium': 0.125,
16-
'low': 0.0675
14+
'ultra': 1,
15+
'high': 0.5,
16+
'medium': 0.25,
17+
'low': 0.125,
18+
'lowest': 0.0675
1719
}
1820

1921
if max_dim > 0:
20-
return int(max_dim * pc_quality_scale[args.pc_quality])
22+
return max(min_dim, int(max_dim * pc_quality_scale[args.pc_quality]))
2123
else:
2224
log.ODM_WARNING("Cannot compute max image dimensions, going with default depthmap_resolution of 640")
2325
return 640 # Sensible default

stages/openmvs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def process(self, args, outputs):
3838
os.mkdir(depthmaps_dir)
3939

4040
depthmap_resolution = get_depthmap_resolution(args, photos)
41-
4241
if outputs["undist_image_max_size"] <= depthmap_resolution:
4342
resolution_level = 0
4443
else:

stages/run_opensfm.py

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,31 @@ def align_to_primary_band(shot_id, image):
147147
for band in reconstruction.multi_camera:
148148
nvm_file = octx.path("undistorted", "reconstruction_%s.nvm" % band['name'].lower())
149149

150-
img_map = {}
151-
for fname in p2s:
150+
if not io.file_exists(nvm_file) or self.rerun():
151+
img_map = {}
152+
153+
if primary_band_name is None:
154+
primary_band_name = multispectral.get_primary_band_name(reconstruction.multi_camera, args.primary_band)
155+
if p2s is None:
156+
s2p, p2s = multispectral.compute_band_maps(reconstruction.multi_camera, primary_band_name)
152157

153-
# Primary band maps to itself
154-
if band['name'] == primary_band_name:
155-
img_map[fname + '.tif'] = fname + '.tif'
156-
else:
157-
band_filename = next((p.filename for p in p2s[fname] if p.band_name == band['name']), None)
158-
159-
if band_filename is not None:
160-
img_map[fname + '.tif'] = band_filename + '.tif'
158+
for fname in p2s:
159+
160+
# Primary band maps to itself
161+
if band['name'] == primary_band_name:
162+
img_map[fname + '.tif'] = fname + '.tif'
161163
else:
162-
log.ODM_WARNING("Cannot find %s band equivalent for %s" % (band, fname))
164+
band_filename = next((p.filename for p in p2s[fname] if p.band_name == band['name']), None)
163165

164-
nvm.replace_nvm_images(tree.opensfm_reconstruction_nvm, img_map, nvm_file)
166+
if band_filename is not None:
167+
img_map[fname + '.tif'] = band_filename + '.tif'
168+
else:
169+
log.ODM_WARNING("Cannot find %s band equivalent for %s" % (band, fname))
165170

171+
nvm.replace_nvm_images(tree.opensfm_reconstruction_nvm, img_map, nvm_file)
172+
else:
173+
log.ODM_WARNING("Found existing NVM file %s" % nvm_file)
174+
166175
self.update_progress(85)
167176

168177
# Skip dense reconstruction if necessary and export

0 commit comments

Comments
 (0)