Add --skip-band-alignment option

pull/1221/head
Piero Toffanin 2020-12-14 20:49:20 -05:00
rodzic 0574569a28
commit e91a428eb9
2 zmienionych plików z 19 dodań i 2 usunięć

Wyświetl plik

@ -752,6 +752,14 @@ def config(argv=None, parser=None):
'It\'s recommended to choose a band which has sharp details and is in focus. '
'Default: %(default)s'))
parser.add_argument('--skip-band-alignment',
action=StoreTrue,
nargs=0,
default=False,
help=('When processing multispectral datasets, ODM will automatically align images for each band. '
'If your images have been postprocessed and are already aligned, you should use this option, which will skip the alignment computations. '
'Default: %(default)s'))
args = parser.parse_args(argv)
# check that the project path setting has been set properly

Wyświetl plik

@ -81,6 +81,10 @@ class ODMOpenSfMStage(types.ODM_Stage):
def align_to_primary_band(shot_id, image):
photo = reconstruction.get_photo(shot_id)
# No need to align if requested by user
if args.skip_band_alignment:
return image
# No need to align primary
if photo.band_name == primary_band_name:
return image
@ -109,11 +113,16 @@ class ODMOpenSfMStage(types.ODM_Stage):
# We finally restore the original files later
added_shots_file = octx.path('added_shots_done.txt')
if not io.file_exists(added_shots_file) or self.rerun():
primary_band_name = multispectral.get_primary_band_name(reconstruction.multi_camera, args.primary_band)
s2p, p2s = multispectral.compute_band_maps(reconstruction.multi_camera, primary_band_name)
alignment_info = multispectral.compute_alignment_matrices(reconstruction.multi_camera, primary_band_name, tree.dataset_raw, s2p, p2s, max_concurrency=args.max_concurrency)
if not args.skip_band_alignment:
alignment_info = multispectral.compute_alignment_matrices(reconstruction.multi_camera, primary_band_name, tree.dataset_raw, s2p, p2s, max_concurrency=args.max_concurrency)
else:
log.ODM_WARNING("Skipping band alignment")
alignment_info = {}
log.ODM_INFO("Adding shots to reconstruction")