kopia lustrzana https://github.com/OpenDroneMap/ODM
Convert from orb_slam to pmts
rodzic
bfa811c58e
commit
0201ba4497
|
@ -128,7 +128,8 @@ if __name__ == '__main__':
|
|||
|
||||
r = {
|
||||
'cameras': {},
|
||||
'shots': {}
|
||||
'shots': {},
|
||||
'points': {},
|
||||
}
|
||||
|
||||
r['cameras']['slamcam'] = camera_from_config(args.video, args.config)
|
||||
|
|
|
@ -16,6 +16,9 @@ sys.path.append(pyopencv_path)
|
|||
# define opensfm path
|
||||
opensfm_path = os.path.join(superbuild_path, "src/opensfm")
|
||||
|
||||
# define orb_slam2 path
|
||||
orb_slam2_path = os.path.join(superbuild_path, "src/orb_slam2")
|
||||
|
||||
# define pmvs path
|
||||
cmvs_path = os.path.join(superbuild_path, "install/bin/cmvs")
|
||||
cmvs_opts_path = os.path.join(superbuild_path, "install/bin/genOption")
|
||||
|
@ -26,6 +29,7 @@ txt2las_path = os.path.join(superbuild_path, 'src/las-tools/bin')
|
|||
|
||||
# define odm modules path
|
||||
odm_modules_path = os.path.join(root_path, "build/bin")
|
||||
odm_modules_src_path = os.path.join(root_path, "modules")
|
||||
|
||||
# Define supported image extensions
|
||||
supported_extensions = {'.jpg','.jpeg','.png'}
|
||||
|
|
|
@ -3,6 +3,7 @@ import os
|
|||
import ecto
|
||||
|
||||
from opendm import log
|
||||
from opendm import io
|
||||
from opendm import system
|
||||
from opendm import context
|
||||
|
||||
|
@ -33,12 +34,52 @@ class ODMSlamCell(ecto.Cell):
|
|||
system.mkdir_p(tree.opensfm)
|
||||
system.mkdir_p(tree.pmvs)
|
||||
|
||||
# run meshing binary
|
||||
system.run(
|
||||
'{}/odm_slam '
|
||||
'SuperBuild/src/orb_slam2/Vocabulary/ORBvoc.txt '
|
||||
'SuperBuild/src/orb_slam2/Examples/Monocular/TUM1.yaml '
|
||||
'{}'.format(context.odm_modules_path, video))
|
||||
vocabulary = os.path.join(context.orb_slam2_path, 'Vocabulary/ORBvoc.txt')
|
||||
config_file = os.path.join(context.orb_slam2_path, 'Examples/Monocular/TUM1.yaml')
|
||||
orb_slam_cmd = os.path.join(context.odm_modules_path, 'odm_slam')
|
||||
|
||||
# run slam binary
|
||||
system.run(' '.join([
|
||||
'cd {} &&'.format(tree.opensfm),
|
||||
orb_slam_cmd,
|
||||
vocabulary,
|
||||
config_file,
|
||||
video,
|
||||
]))
|
||||
|
||||
system.run(' '.join([
|
||||
'cd {} &&'.format(tree.opensfm),
|
||||
'PYTHONPATH={}:{}'.format(context.pyopencv_path, context.opensfm_path),
|
||||
'python',
|
||||
os.path.join(context.odm_modules_src_path, 'odm_slam/src/orb_slam_to_opensfm.py'),
|
||||
video,
|
||||
os.path.join(tree.opensfm, 'KeyFrameTrajectory.txt'),
|
||||
config_file,
|
||||
]))
|
||||
|
||||
|
||||
|
||||
### check if reconstruction was exported to bundler before
|
||||
|
||||
if not io.file_exists(tree.opensfm_bundle_list) or rerun_cell:
|
||||
# convert back to bundler's format
|
||||
system.run('PYTHONPATH=%s %s/bin/export_bundler %s' %
|
||||
(context.pyopencv_path, context.opensfm_path, tree.opensfm))
|
||||
else:
|
||||
log.ODM_WARNING('Found a valid Bundler file in: %s' %
|
||||
(tree.opensfm_reconstruction))
|
||||
|
||||
|
||||
### check if reconstruction was exported to pmvs before
|
||||
|
||||
if not io.file_exists(tree.pmvs_visdat) or rerun_cell:
|
||||
# run PMVS converter
|
||||
system.run('PYTHONPATH=%s %s/bin/export_pmvs %s --output %s' %
|
||||
(context.pyopencv_path, context.opensfm_path, tree.opensfm, tree.pmvs))
|
||||
else:
|
||||
log.ODM_WARNING('Found a valid CMVS file in: %s' % tree.pmvs_visdat)
|
||||
|
||||
log.ODM_INFO('Running OMD Slam Cell - Finished')
|
||||
return ecto.OK if args['end_with'] != 'opensfm' else ecto.QUIT
|
||||
return ecto.OK if args['end_with'] != 'odm_slam' else ecto.QUIT
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue