Remove --pc-geometric, skip visibility filtering

pull/1551/head
Piero Toffanin 2022-11-10 14:25:26 -05:00
rodzic edd7809eb6
commit ed8bc94288
4 zmienionych plików z 21 dodań i 80 usunięć

Wyświetl plik

@ -1 +1 @@
2.9.2
3.0.0

Wyświetl plik

@ -83,15 +83,6 @@ def config(argv=None, parser=None):
nargs='?',
help='Name of dataset (i.e subfolder name within project folder). Default: %(default)s')
parser.add_argument('--resize-to',
metavar='<integer>',
action=StoreValue,
default=2048,
type=int,
help='Legacy option (use --feature-quality instead). Resizes images by the largest side for feature extraction purposes only. '
'Set to -1 to disable. This does not affect the final orthophoto '
'resolution quality and will not resize the original images. Default: %(default)s')
parser.add_argument('--end-with', '-e',
metavar='<string>',
action=StoreValue,
@ -414,13 +405,6 @@ def config(argv=None, parser=None):
help='Reduce the memory usage needed for depthmap fusion by splitting large scenes into tiles. Turn this on if your machine doesn\'t have much RAM and/or you\'ve set --pc-quality to high or ultra. Experimental. '
'Default: %(default)s')
parser.add_argument('--pc-geometric',
action=StoreTrue,
nargs=0,
default=False,
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('--smrf-scalar',
metavar='<positive float>',
action=StoreValue,

Wyświetl plik

@ -202,27 +202,22 @@ class OSFMContext:
# Compute feature_process_size
feature_process_size = 2048 # default
if ('resize_to_is_set' in args) and args.resize_to > 0:
# Legacy
log.ODM_WARNING("Legacy option --resize-to (this might be removed in a future version). Use --feature-quality instead.")
feature_process_size = int(args.resize_to)
feature_quality_scale = {
'ultra': 1,
'high': 0.5,
'medium': 0.25,
'low': 0.125,
'lowest': 0.0675,
}
max_dim = find_largest_photo_dim(photos)
if max_dim > 0:
log.ODM_INFO("Maximum photo dimensions: %spx" % str(max_dim))
feature_process_size = int(max_dim * feature_quality_scale[args.feature_quality])
log.ODM_INFO("Photo dimensions for feature extraction: %ipx" % feature_process_size)
else:
feature_quality_scale = {
'ultra': 1,
'high': 0.5,
'medium': 0.25,
'low': 0.125,
'lowest': 0.0675,
}
max_dim = find_largest_photo_dim(photos)
if max_dim > 0:
log.ODM_INFO("Maximum photo dimensions: %spx" % str(max_dim))
feature_process_size = int(max_dim * feature_quality_scale[args.feature_quality])
log.ODM_INFO("Photo dimensions for feature extraction: %ipx" % feature_process_size)
else:
log.ODM_WARNING("Cannot compute max image dimensions, going with defaults")
log.ODM_WARNING("Cannot compute max image dimensions, going with defaults")
# create config file for OpenSfM
if args.matcher_neighbors > 0:

Wyświetl plik

@ -87,17 +87,13 @@ class ODMOpenMVSStage(types.ODM_Stage):
extra_config = []
if not args.pc_geometric:
extra_config.append("--geometric-iters 0")
masks_dir = os.path.join(tree.opensfm, "undistorted", "masks")
masks = os.path.exists(masks_dir) and len(os.listdir(masks_dir)) > 0
if masks:
extra_config.append("--ignore-mask-label 0")
sharp = args.pc_geometric
with open(densify_ini_file, 'w+') as f:
f.write("Optimize = %s\n" % (7 if sharp else 3))
f.write("Optimize = 7\n")
def run_densify():
system.run('"%s" "%s" %s' % (context.omvs_densify_path,
@ -171,18 +167,8 @@ class ODMOpenMVSStage(types.ODM_Stage):
'-v 0',
]
try:
system.run('"%s" "%s" %s' % (context.omvs_densify_path, sf, ' '.join(config + gpu_config + extra_config)))
# Filter
if args.pc_filter > 0:
system.run('"%s" "%s" --filter-point-cloud -1 -v 0 %s' % (context.omvs_densify_path, scene_dense_mvs, ' '.join(gpu_config)))
else:
# Just rename
log.ODM_INFO("Skipped filtering, %s --> %s" % (scene_ply_unfiltered, scene_ply))
os.rename(scene_ply_unfiltered, scene_ply)
except:
log.ODM_WARNING("Sub-scene %s could not be reconstructed, skipping..." % sf)
# Do not filter
os.rename(scene_ply_unfiltered, scene_ply)
if not io.file_exists(scene_ply):
scene_ply_files.pop()
@ -202,32 +188,8 @@ class ODMOpenMVSStage(types.ODM_Stage):
# Merge
fast_merge_ply(scene_ply_files, tree.openmvs_model)
else:
def skip_filtering():
# Just rename
scene_dense_ply = os.path.join(tree.openmvs, 'scene_dense.ply')
log.ODM_INFO("Skipped filtering, %s --> %s" % (scene_dense_ply, tree.openmvs_model))
os.rename(scene_dense_ply, tree.openmvs_model)
# Filter all at once
if args.pc_filter > 0:
if os.path.exists(scene_dense):
config = [
"--filter-point-cloud -1",
'-i "%s"' % scene_dense,
"-v 0"
]
try:
system.run('"%s" %s' % (context.omvs_densify_path, ' '.join(config + gpu_config + extra_config)))
except system.SubprocessException as e:
if e.errorCode == 137 or e.errorCode == 3221226505:
log.ODM_WARNING("OpenMVS filtering ran out of memory, visibility checks will be skipped.")
skip_filtering()
else:
raise e
else:
raise system.ExitException("Cannot find scene_dense.mvs, dense reconstruction probably failed. Exiting...")
else:
skip_filtering()
scene_dense_ply = os.path.join(tree.openmvs, 'scene_dense.ply')
os.rename(scene_dense_ply, tree.openmvs_model)
self.update_progress(95)