kopia lustrzana https://github.com/OpenDroneMap/ODM
rodzic
ad891bf6b2
commit
cdfd25135b
|
@ -11,7 +11,7 @@ import sys
|
|||
# parse arguments
|
||||
processopts = ['dataset', 'split', 'merge', 'opensfm', 'mve', 'odm_filterpoints',
|
||||
'odm_meshing', 'mvs_texturing', 'odm_georeferencing',
|
||||
'odm_dem', 'odm_orthophoto']
|
||||
'odm_dem', 'odm_orthophoto', 'odm_report']
|
||||
|
||||
with open(io.join_paths(context.root_path, 'VERSION')) as version_file:
|
||||
__version__ = version_file.read().strip()
|
||||
|
|
|
@ -14,7 +14,7 @@ def get_origin(shot):
|
|||
"""The origin of the pose in world coordinates."""
|
||||
return -get_rotation_matrix(np.array(shot['rotation'])).T.dot(np.array(shot['translation']))
|
||||
|
||||
def extract_shots_from_opensfm(reconstruction_file, geocoords_transformation_file=None, utm_srs=None):
|
||||
def get_geojson_shots_from_opensfm(reconstruction_file, geocoords_transformation_file=None, utm_srs=None):
|
||||
"""
|
||||
Extract shots from OpenSfM's reconstruction.json
|
||||
"""
|
||||
|
@ -77,3 +77,5 @@ def extract_shots_from_opensfm(reconstruction_file, geocoords_transformation_fil
|
|||
else:
|
||||
raise RuntimeError("%s does not exist." % reconstruction_file)
|
||||
|
||||
def merge_geojson_shots(geojson_shots_files):
|
||||
pass
|
|
@ -220,6 +220,8 @@ class ODM_Tree(object):
|
|||
self.odm_25dgeoreferencing = io.join_paths(self.root_path, 'odm_georeferencing_25d')
|
||||
self.odm_filterpoints = io.join_paths(self.root_path, 'odm_filterpoints')
|
||||
self.odm_orthophoto = io.join_paths(self.root_path, 'odm_orthophoto')
|
||||
self.odm_report = io.join_paths(self.root_path, 'odm_report')
|
||||
|
||||
|
||||
# important files paths
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ from odm_orthophoto import ODMOrthoPhotoStage
|
|||
from odm_dem import ODMDEMStage
|
||||
from odm_filterpoints import ODMFilterPoints
|
||||
from splitmerge import ODMSplitStage, ODMMergeStage
|
||||
from odm_report import ODMReport
|
||||
|
||||
|
||||
class ODMApp:
|
||||
|
@ -57,7 +58,8 @@ class ODMApp:
|
|||
dem = ODMDEMStage('odm_dem', args, progress=90.0,
|
||||
max_concurrency=args.max_concurrency,
|
||||
verbose=args.verbose)
|
||||
orthophoto = ODMOrthoPhotoStage('odm_orthophoto', args, progress=100.0)
|
||||
orthophoto = ODMOrthoPhotoStage('odm_orthophoto', args, progress=98.0)
|
||||
report = ODMReport('odm_report', args, progress=100.0)
|
||||
|
||||
# Normal pipeline
|
||||
self.first_stage = dataset
|
||||
|
@ -77,7 +79,8 @@ class ODMApp:
|
|||
.connect(texturing) \
|
||||
.connect(georeferencing) \
|
||||
.connect(dem) \
|
||||
.connect(orthophoto)
|
||||
.connect(orthophoto) \
|
||||
.connect(report)
|
||||
|
||||
# # SLAM pipeline
|
||||
# # TODO: this is broken and needs work
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
import os
|
||||
|
||||
from opendm import log
|
||||
from opendm import io
|
||||
from opendm import system
|
||||
from opendm import types
|
||||
from opendm.shots import get_geojson_shots_from_opensfm
|
||||
import json
|
||||
|
||||
|
||||
class ODMReport(types.ODM_Stage):
|
||||
def process(self, args, outputs):
|
||||
tree = outputs['tree']
|
||||
reconstruction = outputs['reconstruction']
|
||||
|
||||
if not os.path.exists(tree.odm_report): system.mkdir_p(tree.odm_report)
|
||||
|
||||
shots_geojson = os.path.join(tree.odm_report, "shots.geojson")
|
||||
if not io.file_exists(shots_geojson) or self.rerun():
|
||||
# Extract geographical camera shots
|
||||
if reconstruction.is_georeferenced():
|
||||
shots = get_geojson_shots_from_opensfm(tree.opensfm_reconstruction, tree.opensfm_transformation, reconstruction.get_proj_srs())
|
||||
else:
|
||||
# Psuedo geo
|
||||
shots = get_geojson_shots_from_opensfm(tree.opensfm_reconstruction)
|
||||
|
||||
with open(shots_geojson, "w") as fout:
|
||||
fout.write(json.dumps(shots))
|
||||
|
||||
logger.info("Wrote %s" % shots_geojson)
|
||||
else:
|
||||
log.ODM_WARNING('Found a valid shots file in: %s' %
|
||||
tree.shots_geojson)
|
Ładowanie…
Reference in New Issue