2019-04-23 17:59:54 +00:00
|
|
|
from opendm import log
|
|
|
|
from opendm import osfm
|
2019-04-23 18:45:47 +00:00
|
|
|
from opendm import types
|
2019-04-23 17:59:54 +00:00
|
|
|
|
|
|
|
class ODMSplitStage(types.ODM_Stage):
|
|
|
|
def process(self, args, outputs):
|
|
|
|
tree = outputs['tree']
|
|
|
|
reconstruction = outputs['reconstruction']
|
|
|
|
photos = reconstruction.photos
|
|
|
|
|
2019-04-23 18:45:47 +00:00
|
|
|
outputs['large'] = len(photos) > args.split
|
|
|
|
|
|
|
|
if outputs['large']:
|
|
|
|
log.ODM_INFO("Large dataset detected (%s photos) and split set at %s. Preparing split merge." % (len(photos), args.split))
|
|
|
|
config = [
|
|
|
|
"submodels_relpath: ../submodels/opensfm",
|
|
|
|
"submodel_relpath_template: ../submodels/submodel_%04d/opensfm",
|
|
|
|
"submodel_images_relpath_template: ../submodels/submodel_%04d/images",
|
|
|
|
"submodel_size: %s" % args.split,
|
|
|
|
"submodel_overlap: %s" % args.split_overlap,
|
|
|
|
]
|
|
|
|
|
|
|
|
osfm.setup(args, tree.dataset_raw, tree.opensfm, photos, gcp_path=tree.odm_georeferencing_gcp, append_config=config)
|
2019-04-23 17:59:54 +00:00
|
|
|
|
2019-04-23 18:45:47 +00:00
|
|
|
osfm.run_feature_matching(tree.opensfm, self.rerun())
|
2019-04-23 17:59:54 +00:00
|
|
|
|
2019-04-23 18:45:47 +00:00
|
|
|
# Create submodels
|
|
|
|
osfm.run("create_submodels", tree.opensfm)
|
|
|
|
exit(1)
|
|
|
|
else:
|
|
|
|
log.ODM_INFO("Normal dataset, will process all at once.")
|
2019-04-23 17:59:54 +00:00
|
|
|
|