2016-02-29 14:45:00 +00:00
|
|
|
import os
|
2015-11-26 12:15:02 +00:00
|
|
|
|
2015-11-27 16:52:27 +00:00
|
|
|
from opendm import context
|
2015-12-10 11:01:41 +00:00
|
|
|
from opendm import types
|
2016-02-29 14:45:00 +00:00
|
|
|
from opendm import io
|
2016-02-29 14:47:54 +00:00
|
|
|
from opendm import system
|
2019-04-22 19:14:39 +00:00
|
|
|
from opendm import log
|
|
|
|
|
2020-09-09 16:10:24 +00:00
|
|
|
from stages.dataset import ODMLoadDatasetStage
|
|
|
|
from stages.run_opensfm import ODMOpenSfMStage
|
2020-10-27 21:10:10 +00:00
|
|
|
from stages.openmvs import ODMOpenMVSStage
|
2020-09-09 16:10:24 +00:00
|
|
|
from stages.odm_meshing import ODMeshingStage
|
|
|
|
from stages.mvstex import ODMMvsTexStage
|
|
|
|
from stages.odm_georeferencing import ODMGeoreferencingStage
|
|
|
|
from stages.odm_orthophoto import ODMOrthoPhotoStage
|
|
|
|
from stages.odm_dem import ODMDEMStage
|
|
|
|
from stages.odm_filterpoints import ODMFilterPoints
|
|
|
|
from stages.splitmerge import ODMSplitStage, ODMMergeStage
|
2015-11-26 12:15:02 +00:00
|
|
|
|
2020-09-09 16:10:24 +00:00
|
|
|
from stages.odm_report import ODMReport
|
2016-02-26 18:50:12 +00:00
|
|
|
|
2019-04-22 19:14:39 +00:00
|
|
|
class ODMApp:
|
|
|
|
def __init__(self, args):
|
2015-11-26 12:15:02 +00:00
|
|
|
"""
|
2019-04-22 19:14:39 +00:00
|
|
|
Initializes the application and defines the ODM application pipeline stages
|
2015-11-26 12:15:02 +00:00
|
|
|
"""
|
2019-06-28 15:10:08 +00:00
|
|
|
if args.debug:
|
|
|
|
log.logger.show_debug = True
|
2019-04-22 19:14:39 +00:00
|
|
|
|
2019-05-15 21:04:09 +00:00
|
|
|
dataset = ODMLoadDatasetStage('dataset', args, progress=5.0,
|
2019-06-21 18:47:00 +00:00
|
|
|
verbose=args.verbose)
|
2019-05-15 21:04:09 +00:00
|
|
|
split = ODMSplitStage('split', args, progress=75.0)
|
|
|
|
merge = ODMMergeStage('merge', args, progress=100.0)
|
|
|
|
opensfm = ODMOpenSfMStage('opensfm', args, progress=25.0)
|
2020-10-27 21:10:10 +00:00
|
|
|
openmvs = ODMOpenMVSStage('openmvs', args, progress=50.0)
|
2019-05-15 21:04:09 +00:00
|
|
|
filterpoints = ODMFilterPoints('odm_filterpoints', args, progress=52.0)
|
|
|
|
meshing = ODMeshingStage('odm_meshing', args, progress=60.0,
|
2019-04-22 19:14:39 +00:00
|
|
|
max_vertex=args.mesh_size,
|
|
|
|
oct_tree=args.mesh_octree_depth,
|
2020-12-19 17:29:00 +00:00
|
|
|
samples=1.0,
|
|
|
|
point_weight=4.0,
|
2019-04-22 19:14:39 +00:00
|
|
|
max_concurrency=args.max_concurrency,
|
|
|
|
verbose=args.verbose)
|
2019-05-15 21:04:09 +00:00
|
|
|
texturing = ODMMvsTexStage('mvs_texturing', args, progress=70.0,
|
2019-04-22 19:14:39 +00:00
|
|
|
data_term=args.texturing_data_term,
|
|
|
|
outlier_rem_type=args.texturing_outlier_removal_type,
|
|
|
|
skip_glob_seam_leveling=args.texturing_skip_global_seam_leveling,
|
|
|
|
skip_loc_seam_leveling=args.texturing_skip_local_seam_leveling,
|
|
|
|
tone_mapping=args.texturing_tone_mapping)
|
2019-05-15 21:04:09 +00:00
|
|
|
georeferencing = ODMGeoreferencingStage('odm_georeferencing', args, progress=80.0,
|
2019-04-22 19:14:39 +00:00
|
|
|
gcp_file=args.gcp,
|
|
|
|
verbose=args.verbose)
|
2019-05-15 21:04:09 +00:00
|
|
|
dem = ODMDEMStage('odm_dem', args, progress=90.0,
|
2019-04-22 19:14:39 +00:00
|
|
|
max_concurrency=args.max_concurrency,
|
|
|
|
verbose=args.verbose)
|
2020-05-15 18:36:46 +00:00
|
|
|
orthophoto = ODMOrthoPhotoStage('odm_orthophoto', args, progress=98.0)
|
|
|
|
report = ODMReport('odm_report', args, progress=100.0)
|
2019-04-25 00:01:44 +00:00
|
|
|
|
2019-06-21 18:47:00 +00:00
|
|
|
# Normal pipeline
|
|
|
|
self.first_stage = dataset
|
2019-04-22 19:14:39 +00:00
|
|
|
|
2019-06-21 18:47:00 +00:00
|
|
|
dataset.connect(split) \
|
|
|
|
.connect(merge) \
|
|
|
|
.connect(opensfm)
|
2019-04-22 19:14:39 +00:00
|
|
|
|
2021-01-13 22:22:44 +00:00
|
|
|
if args.fast_orthophoto:
|
2019-06-21 18:47:00 +00:00
|
|
|
opensfm.connect(filterpoints)
|
2016-09-30 13:08:56 +00:00
|
|
|
else:
|
2020-10-27 21:10:10 +00:00
|
|
|
opensfm.connect(openmvs) \
|
|
|
|
.connect(filterpoints)
|
2019-06-21 18:47:00 +00:00
|
|
|
|
|
|
|
filterpoints \
|
|
|
|
.connect(meshing) \
|
|
|
|
.connect(texturing) \
|
|
|
|
.connect(georeferencing) \
|
|
|
|
.connect(dem) \
|
2020-05-15 18:36:46 +00:00
|
|
|
.connect(orthophoto) \
|
|
|
|
.connect(report)
|
2019-06-21 18:47:00 +00:00
|
|
|
|
2019-04-22 19:14:39 +00:00
|
|
|
def execute(self):
|
|
|
|
self.first_stage.run()
|