Align reconstructions without point constraints

Former-commit-id: 723af4587f
pull/1161/head
Piero Toffanin 2019-05-15 14:27:16 -04:00
rodzic c2b6f13b33
commit c63b51bf2f
2 zmienionych plików z 17 dodań i 10 usunięć

Wyświetl plik

@ -7,6 +7,8 @@ from opendm import io
from opendm import log from opendm import log
from opendm import system from opendm import system
from opendm import context from opendm import context
from opensfm.large import metadataset
from opensfm.large import tools
class OSFMContext: class OSFMContext:
def __init__(self, opensfm_project_path): def __init__(self, opensfm_project_path):
@ -140,7 +142,20 @@ class OSFMContext:
else: else:
log.ODM_WARNING('Match features already done: %s exists' % matches_dir) log.ODM_WARNING('Match features already done: %s exists' % matches_dir)
def align_reconstructions(self, rerun):
alignment_file = self.path('alignment_done.txt')
if not io.file_exists(alignment_file) or rerun:
log.ODM_INFO("Aligning submodels...")
meta_data = metadataset.MetaDataSet(self.opensfm_project_path)
reconstruction_shots = tools.load_reconstruction_shots(meta_data)
transformations = tools.align_reconstructions(reconstruction_shots, use_points_constraints=False)
tools.apply_transformations(transformations)
with open(alignment_file, 'w') as fout:
fout.write("Alignment done!\n")
else:
log.ODM_WARNING('Found a alignment done progress file in: %s' % alignment_file)
def path(self, *paths): def path(self, *paths):
return os.path.join(self.opensfm_project_path, *paths) return os.path.join(self.opensfm_project_path, *paths)

Wyświetl plik

@ -95,15 +95,7 @@ class ODMSplitStage(types.ODM_Stage):
lre.run_reconstruction() lre.run_reconstruction()
# Align # Align
alignment_file = octx.path('alignment_done.txt') octx.align_reconstructions(self.rerun())
if not io.file_exists(alignment_file) or self.rerun():
log.ODM_INFO("Aligning submodels...")
octx.run('align_submodels')
with open(alignment_file, 'w') as fout:
fout.write("Alignment done!\n")
else:
log.ODM_WARNING('Found a alignment matching done progress file in: %s' % alignment_file)
# Aligned reconstruction is in reconstruction.aligned.json # Aligned reconstruction is in reconstruction.aligned.json
# We need to rename it to reconstruction.json # We need to rename it to reconstruction.json