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
from dataset import ODMLoadDatasetStage
from run_opensfm import ODMOpenSfMStage
from mve import ODMMveStage
from odm_slam import ODMSlamStage
from odm_meshing import ODMeshingStage
from mvstex import ODMMvsTexStage
from odm_georeferencing import ODMGeoreferencingStage
from odm_orthophoto import ODMOrthoPhotoStage
from odm_dem import ODMDEMStage
2019-04-03 18:47:06 +00:00
from odm_filterpoints import ODMFilterPoints
2019-04-24 19:15:22 +00:00
from splitmerge import ODMSplitStage , ODMMergeStage
2015-11-26 12:15:02 +00:00
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-04-22 19:14:39 +00:00
dataset = ODMLoadDatasetStage ( ' dataset ' , args ,
verbose = args . verbose ,
proj = args . proj )
2019-04-23 18:45:47 +00:00
split = ODMSplitStage ( ' split ' , args )
2019-04-24 19:15:22 +00:00
merge = ODMMergeStage ( ' merge ' , args )
2019-04-23 18:45:47 +00:00
opensfm = ODMOpenSfMStage ( ' opensfm ' , args )
2019-04-22 19:14:39 +00:00
slam = ODMSlamStage ( ' slam ' , args )
mve = ODMMveStage ( ' mve ' , args )
filterpoints = ODMFilterPoints ( ' odm_filterpoints ' , args )
meshing = ODMeshingStage ( ' odm_meshing ' , args ,
max_vertex = args . mesh_size ,
oct_tree = args . mesh_octree_depth ,
samples = args . mesh_samples ,
point_weight = args . mesh_point_weight ,
max_concurrency = args . max_concurrency ,
verbose = args . verbose )
texturing = ODMMvsTexStage ( ' mvs_texturing ' , args ,
data_term = args . texturing_data_term ,
outlier_rem_type = args . texturing_outlier_removal_type ,
skip_vis_test = args . texturing_skip_visibility_test ,
skip_glob_seam_leveling = args . texturing_skip_global_seam_leveling ,
skip_loc_seam_leveling = args . texturing_skip_local_seam_leveling ,
skip_hole_fill = args . texturing_skip_hole_filling ,
keep_unseen_faces = args . texturing_keep_unseen_faces ,
tone_mapping = args . texturing_tone_mapping )
georeferencing = ODMGeoreferencingStage ( ' odm_georeferencing ' , args ,
gcp_file = args . gcp ,
use_exif = args . use_exif ,
verbose = args . verbose )
dem = ODMDEMStage ( ' odm_dem ' , args ,
max_concurrency = args . max_concurrency ,
verbose = args . verbose )
orthophoto = ODMOrthoPhotoStage ( ' odm_orthophoto ' , args ,
resolution = args . orthophoto_resolution ,
no_tiled = args . orthophoto_no_tiled ,
compress = args . orthophoto_compression ,
bigtiff = args . orthophoto_bigtiff ,
build_overviews = args . build_overviews ,
max_concurrency = args . max_concurrency ,
verbose = args . verbose )
if not args . video :
# Normal pipeline
self . first_stage = dataset
2019-04-24 19:15:22 +00:00
dataset . connect ( split ) \
. connect ( merge ) \
. connect ( opensfm )
2019-04-22 19:14:39 +00:00
if args . use_opensfm_dense or args . fast_orthophoto :
opensfm . connect ( filterpoints )
else :
opensfm . connect ( mve ) \
. connect ( filterpoints )
filterpoints \
. connect ( meshing ) \
. connect ( texturing ) \
. connect ( georeferencing ) \
. connect ( dem ) \
. connect ( orthophoto )
2016-09-30 13:08:56 +00:00
else :
2019-04-22 19:14:39 +00:00
# SLAM pipeline
# TODO: this is broken and needs work
log . ODM_WARNING ( " SLAM module is currently broken. We could use some help fixing this. If you know Python, get in touch at https://community.opendronemap.org. " )
self . first_stage = slam
2016-02-26 18:50:12 +00:00
2019-04-22 19:14:39 +00:00
slam . connect ( mve ) \
. connect ( meshing ) \
. connect ( texturing )
2016-02-26 18:50:12 +00:00
2019-04-22 19:14:39 +00:00
def execute ( self ) :
self . first_stage . run ( )