kopia lustrzana https://github.com/OpenDroneMap/ODM
mve over smvs
rodzic
4302fc7ed9
commit
8e3a01fbb7
|
@ -109,7 +109,7 @@ or
|
||||||
|
|
||||||
python run.py --rerun-from odm_meshing project-name
|
python run.py --rerun-from odm_meshing project-name
|
||||||
|
|
||||||
The options for rerunning are: 'resize', 'opensfm', 'slam', 'smvs', 'odm_meshing', 'mvs_texturing', 'odm_georeferencing', 'odm_orthophoto'
|
The options for rerunning are: 'resize', 'opensfm', 'slam', 'mve', 'odm_meshing', 'mvs_texturing', 'odm_georeferencing', 'odm_orthophoto'
|
||||||
|
|
||||||
### View Results
|
### View Results
|
||||||
|
|
||||||
|
|
|
@ -141,17 +141,17 @@ externalproject_add(mve
|
||||||
INSTALL_COMMAND ""
|
INSTALL_COMMAND ""
|
||||||
)
|
)
|
||||||
|
|
||||||
externalproject_add(smvs
|
#externalproject_add(smvs
|
||||||
DEPENDS mve
|
# DEPENDS mve
|
||||||
GIT_REPOSITORY https://github.com/flanggut/smvs.git
|
# GIT_REPOSITORY https://github.com/flanggut/smvs.git
|
||||||
GIT_TAG 6a7d0c095aa66ab98c5b285c2bc04e34d8993353
|
# GIT_TAG 6a7d0c095aa66ab98c5b285c2bc04e34d8993353
|
||||||
UPDATE_COMMAND ""
|
# UPDATE_COMMAND ""
|
||||||
SOURCE_DIR ${SB_SOURCE_DIR}/elibs/smvs
|
# SOURCE_DIR ${SB_SOURCE_DIR}/elibs/smvs
|
||||||
CONFIGURE_COMMAND ""
|
# CONFIGURE_COMMAND ""
|
||||||
BUILD_IN_SOURCE 1
|
# BUILD_IN_SOURCE 1
|
||||||
BUILD_COMMAND make
|
# BUILD_COMMAND make
|
||||||
INSTALL_COMMAND ""
|
# INSTALL_COMMAND ""
|
||||||
)
|
#)
|
||||||
|
|
||||||
externalproject_add(poissonrecon
|
externalproject_add(poissonrecon
|
||||||
GIT_REPOSITORY https://github.com/mkazhdan/PoissonRecon.git
|
GIT_REPOSITORY https://github.com/mkazhdan/PoissonRecon.git
|
||||||
|
@ -182,4 +182,4 @@ externalproject_add(dem2points
|
||||||
BUILD_IN_SOURCE 1
|
BUILD_IN_SOURCE 1
|
||||||
BUILD_COMMAND make
|
BUILD_COMMAND make
|
||||||
INSTALL_COMMAND ""
|
INSTALL_COMMAND ""
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,7 +7,7 @@ from appsettings import SettingsParser
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# parse arguments
|
# parse arguments
|
||||||
processopts = ['dataset', 'opensfm', 'slam', 'smvs',
|
processopts = ['dataset', 'opensfm', 'slam', 'mve',
|
||||||
'odm_meshing', 'odm_25dmeshing', 'mvs_texturing', 'odm_georeferencing',
|
'odm_meshing', 'odm_25dmeshing', 'mvs_texturing', 'odm_georeferencing',
|
||||||
'odm_dem', 'odm_orthophoto']
|
'odm_dem', 'odm_orthophoto']
|
||||||
|
|
||||||
|
|
|
@ -23,15 +23,15 @@ ccd_widths_path = os.path.join(opensfm_path, 'opensfm/data/sensor_data.json')
|
||||||
# define orb_slam2 path
|
# define orb_slam2 path
|
||||||
orb_slam2_path = os.path.join(superbuild_path, "src/orb_slam2")
|
orb_slam2_path = os.path.join(superbuild_path, "src/orb_slam2")
|
||||||
|
|
||||||
# define smvs join_paths
|
# define mve join_paths
|
||||||
makescene_path = os.path.join(superbuild_path, 'src', 'elibs', 'mve', 'apps', 'makescene', 'makescene') #TODO: don't install in source
|
makescene_path = os.path.join(superbuild_path, 'src', 'elibs', 'mve', 'apps', 'makescene', 'makescene') #TODO: don't install in source
|
||||||
smvs_path = os.path.join(superbuild_path, 'src', 'elibs', 'smvs', 'app', 'smvsrecon')
|
mve_path = os.path.join(superbuild_path, 'src', 'elibs', 'mve', 'app', 'dmrecon', 'dmrecon')
|
||||||
|
mve_path_pc = os.path.join(superbuild_path, 'src', 'elibs', 'mve', 'app', 'scene2pset', 'scene2pset')
|
||||||
|
|
||||||
poisson_recon_path = os.path.join(superbuild_path, 'src', 'PoissonRecon', 'Bin', 'Linux', 'PoissonRecon')
|
poisson_recon_path = os.path.join(superbuild_path, 'src', 'PoissonRecon', 'Bin', 'Linux', 'PoissonRecon')
|
||||||
dem2mesh_path = os.path.join(superbuild_path, 'src', 'dem2mesh', 'dem2mesh')
|
dem2mesh_path = os.path.join(superbuild_path, 'src', 'dem2mesh', 'dem2mesh')
|
||||||
dem2points_path = os.path.join(superbuild_path, 'src', 'dem2points', 'dem2points')
|
dem2points_path = os.path.join(superbuild_path, 'src', 'dem2points', 'dem2points')
|
||||||
|
|
||||||
|
|
||||||
# define mvstex path
|
# define mvstex path
|
||||||
mvstex_path = os.path.join(superbuild_path, "install/bin/texrecon")
|
mvstex_path = os.path.join(superbuild_path, "install/bin/texrecon")
|
||||||
|
|
||||||
|
|
|
@ -340,7 +340,7 @@ class ODM_Tree(object):
|
||||||
# whole reconstruction process.
|
# whole reconstruction process.
|
||||||
self.dataset_raw = io.join_paths(self.root_path, 'images')
|
self.dataset_raw = io.join_paths(self.root_path, 'images')
|
||||||
self.opensfm = io.join_paths(self.root_path, 'opensfm')
|
self.opensfm = io.join_paths(self.root_path, 'opensfm')
|
||||||
self.smvs = io.join_paths(self.root_path, 'smvs')
|
self.mve = io.join_paths(self.root_path, 'mve')
|
||||||
self.odm_meshing = io.join_paths(self.root_path, 'odm_meshing')
|
self.odm_meshing = io.join_paths(self.root_path, 'odm_meshing')
|
||||||
self.odm_texturing = io.join_paths(self.root_path, 'odm_texturing')
|
self.odm_texturing = io.join_paths(self.root_path, 'odm_texturing')
|
||||||
self.odm_25dtexturing = io.join_paths(self.root_path, 'odm_texturing_25d')
|
self.odm_25dtexturing = io.join_paths(self.root_path, 'odm_texturing_25d')
|
||||||
|
@ -365,12 +365,12 @@ class ODM_Tree(object):
|
||||||
self.opensfm_model = io.join_paths(self.opensfm, 'depthmaps/merged.ply')
|
self.opensfm_model = io.join_paths(self.opensfm, 'depthmaps/merged.ply')
|
||||||
self.opensfm_transformation = io.join_paths(self.opensfm, 'geocoords_transformation.txt')
|
self.opensfm_transformation = io.join_paths(self.opensfm, 'geocoords_transformation.txt')
|
||||||
|
|
||||||
# smvs
|
# mve
|
||||||
self.smvs_model = io.join_paths(self.smvs, 'smvs_dense_point_cloud.ply')
|
self.mve_model = io.join_paths(self.mve, 'mve_dense_point_cloud.ply')
|
||||||
self.mve_path = io.join_paths(self.opensfm, 'mve')
|
self.mve_path = io.join_paths(self.opensfm, 'mve')
|
||||||
self.mve_image_list = io.join_paths(self.mve_path, 'list.txt')
|
self.mve_image_list = io.join_paths(self.mve_path, 'list.txt')
|
||||||
self.mve_bundle = io.join_paths(self.mve_path, 'bundle/bundle.out')
|
self.mve_bundle = io.join_paths(self.mve_path, 'bundle/bundle.out')
|
||||||
self.mve_views = io.join_paths(self.smvs, 'views')
|
self.mve_views = io.join_paths(self.mve, 'views')
|
||||||
|
|
||||||
# odm_meshing
|
# odm_meshing
|
||||||
self.odm_mesh = io.join_paths(self.odm_meshing, 'odm_mesh.ply')
|
self.odm_mesh = io.join_paths(self.odm_meshing, 'odm_mesh.ply')
|
||||||
|
|
2
run.py
2
run.py
|
@ -33,7 +33,7 @@ if __name__ == '__main__':
|
||||||
+ args.project_path + "/odm_orthophoto "
|
+ args.project_path + "/odm_orthophoto "
|
||||||
+ args.project_path + "/odm_texturing "
|
+ args.project_path + "/odm_texturing "
|
||||||
+ args.project_path + "/opensfm "
|
+ args.project_path + "/opensfm "
|
||||||
+ args.project_path + "/smvs")
|
+ args.project_path + "/mve")
|
||||||
|
|
||||||
# create an instance of my App BlackBox
|
# create an instance of my App BlackBox
|
||||||
# internally configure all tasks
|
# internally configure all tasks
|
||||||
|
|
|
@ -6,7 +6,7 @@ from opendm import system
|
||||||
from opendm import context
|
from opendm import context
|
||||||
|
|
||||||
|
|
||||||
class ODMSmvsCell(ecto.Cell):
|
class ODMMveCell(ecto.Cell):
|
||||||
def declare_params(self, params):
|
def declare_params(self, params):
|
||||||
params.declare("threads", "max number of threads", context.num_cores)
|
params.declare("threads", "max number of threads", context.num_cores)
|
||||||
params.declare("alpha", "Regularization parameter", 1)
|
params.declare("alpha", "Regularization parameter", 1)
|
||||||
|
@ -27,7 +27,7 @@ class ODMSmvsCell(ecto.Cell):
|
||||||
# Benchmarking
|
# Benchmarking
|
||||||
start_time = system.now_raw()
|
start_time = system.now_raw()
|
||||||
|
|
||||||
log.ODM_INFO('Running SMVS Cell')
|
log.ODM_INFO('Running MVE Cell')
|
||||||
|
|
||||||
# get inputs
|
# get inputs
|
||||||
tree = inputs.tree
|
tree = inputs.tree
|
||||||
|
@ -36,18 +36,18 @@ class ODMSmvsCell(ecto.Cell):
|
||||||
photos = reconstruction.photos
|
photos = reconstruction.photos
|
||||||
|
|
||||||
if not photos:
|
if not photos:
|
||||||
log.ODM_ERROR('Not enough photos in photos array to start SMVS')
|
log.ODM_ERROR('Not enough photos in photos array to start MVE')
|
||||||
return ecto.QUIT
|
return ecto.QUIT
|
||||||
|
|
||||||
# check if we rerun cell or not
|
# check if we rerun cell or not
|
||||||
rerun_cell = (args.rerun is not None and
|
rerun_cell = (args.rerun is not None and
|
||||||
args.rerun == 'smvs') or \
|
args.rerun == 'mve') or \
|
||||||
(args.rerun_all) or \
|
(args.rerun_all) or \
|
||||||
(args.rerun_from is not None and
|
(args.rerun_from is not None and
|
||||||
'smvs' in args.rerun_from)
|
'mve' in args.rerun_from)
|
||||||
|
|
||||||
# check if reconstruction was done before
|
# check if reconstruction was done before
|
||||||
if not io.file_exists(tree.smvs_model) or rerun_cell:
|
if not io.file_exists(tree.mve_model) or rerun_cell:
|
||||||
# cleanup if a rerun
|
# cleanup if a rerun
|
||||||
if io.dir_exists(tree.mve_path) and rerun_cell:
|
if io.dir_exists(tree.mve_path) and rerun_cell:
|
||||||
shutil.rmtree(tree.mve_path)
|
shutil.rmtree(tree.mve_path)
|
||||||
|
@ -62,12 +62,12 @@ class ODMSmvsCell(ecto.Cell):
|
||||||
# mve makescene wants the output directory
|
# mve makescene wants the output directory
|
||||||
# to not exists before executing it (otherwise it
|
# to not exists before executing it (otherwise it
|
||||||
# will prompt the user for confirmation)
|
# will prompt the user for confirmation)
|
||||||
if io.dir_exists(tree.smvs):
|
if io.dir_exists(tree.mve):
|
||||||
shutil.rmtree(tree.smvs)
|
shutil.rmtree(tree.mve)
|
||||||
|
|
||||||
# run mve makescene
|
# run mve makescene
|
||||||
if not io.dir_exists(tree.mve_views):
|
if not io.dir_exists(tree.mve_views):
|
||||||
system.run('%s %s %s' % (context.makescene_path, tree.mve_path, tree.smvs))
|
system.run('%s %s %s' % (context.makescene_path, tree.mve_path, tree.mve))
|
||||||
|
|
||||||
# config
|
# config
|
||||||
config = [
|
config = [
|
||||||
|
@ -81,26 +81,26 @@ class ODMSmvsCell(ecto.Cell):
|
||||||
"--force" if rerun_cell else ''
|
"--force" if rerun_cell else ''
|
||||||
]
|
]
|
||||||
|
|
||||||
# run smvs
|
# run mve
|
||||||
system.run('%s %s %s' % (context.smvs_path, ' '.join(config), tree.smvs))
|
system.run('%s %s %s' % (context.mve_path, ' '.join(config), tree.mve))
|
||||||
|
|
||||||
# find and rename the output file for simplicity
|
# find and rename the output file for simplicity
|
||||||
smvs_files = glob.glob(os.path.join(tree.smvs, 'smvs-*'))
|
mve_files = glob.glob(os.path.join(tree.mve, 'mve-*'))
|
||||||
smvs_files.sort(key=os.path.getmtime) # sort by last modified date
|
mve_files.sort(key=os.path.getmtime) # sort by last modified date
|
||||||
if len(smvs_files) > 0:
|
if len(mve_files) > 0:
|
||||||
old_file = smvs_files[-1]
|
old_file = mve_files[-1]
|
||||||
if not (io.rename_file(old_file, tree.smvs_model)):
|
if not (io.rename_file(old_file, tree.mve_model)):
|
||||||
log.ODM_WARNING("File %s does not exist, cannot be renamed. " % old_file)
|
log.ODM_WARNING("File %s does not exist, cannot be renamed. " % old_file)
|
||||||
else:
|
else:
|
||||||
log.ODM_WARNING("Cannot find a valid point cloud (smvs-XX.ply) in %s. Check the console output for errors." % tree.smvs)
|
log.ODM_WARNING("Cannot find a valid point cloud (mve-XX.ply) in %s. Check the console output for errors." % tree.mve)
|
||||||
else:
|
else:
|
||||||
log.ODM_WARNING('Found a valid SMVS reconstruction file in: %s' %
|
log.ODM_WARNING('Found a valid MVE reconstruction file in: %s' %
|
||||||
tree.smvs_model)
|
tree.mve_model)
|
||||||
|
|
||||||
outputs.reconstruction = reconstruction
|
outputs.reconstruction = reconstruction
|
||||||
|
|
||||||
if args.time:
|
if args.time:
|
||||||
system.benchmark(start_time, tree.benchmarking, 'SMVS')
|
system.benchmark(start_time, tree.benchmarking, 'MVE')
|
||||||
|
|
||||||
log.ODM_INFO('Running ODM SMVS Cell - Finished')
|
log.ODM_INFO('Running ODM MVE Cell - Finished')
|
||||||
return ecto.OK if args.end_with != 'smvs' else ecto.QUIT
|
return ecto.OK if args.end_with != 'mve' else ecto.QUIT
|
|
@ -8,7 +8,7 @@ from opendm import system
|
||||||
|
|
||||||
from dataset import ODMLoadDatasetCell
|
from dataset import ODMLoadDatasetCell
|
||||||
from run_opensfm import ODMOpenSfMCell
|
from run_opensfm import ODMOpenSfMCell
|
||||||
from smvs import ODMSmvsCell
|
from mve import ODMMvsCell
|
||||||
from odm_slam import ODMSlamCell
|
from odm_slam import ODMSlamCell
|
||||||
from odm_meshing import ODMeshingCell
|
from odm_meshing import ODMeshingCell
|
||||||
from mvstex import ODMMvsTexCell
|
from mvstex import ODMMvsTexCell
|
||||||
|
@ -49,13 +49,7 @@ class ODMApp(ecto.BlackBox):
|
||||||
fixed_camera_params=p.args.use_fixed_camera_params,
|
fixed_camera_params=p.args.use_fixed_camera_params,
|
||||||
hybrid_bundle_adjustment=p.args.use_hybrid_bundle_adjustment),
|
hybrid_bundle_adjustment=p.args.use_hybrid_bundle_adjustment),
|
||||||
'slam': ODMSlamCell(),
|
'slam': ODMSlamCell(),
|
||||||
'smvs': ODMSmvsCell(alpha=p.args.smvs_alpha,
|
'mve': ODMMveCell(),
|
||||||
max_pixels=p.args.depthmap_resolution*p.args.depthmap_resolution,
|
|
||||||
threads=p.args.max_concurrency,
|
|
||||||
output_scale=p.args.smvs_output_scale,
|
|
||||||
shading=p.args.smvs_enable_shading,
|
|
||||||
gamma_srgb=p.args.smvs_gamma_srgb,
|
|
||||||
verbose=p.args.verbose),
|
|
||||||
'meshing': ODMeshingCell(max_vertex=p.args.mesh_size,
|
'meshing': ODMeshingCell(max_vertex=p.args.mesh_size,
|
||||||
oct_tree=p.args.mesh_octree_depth,
|
oct_tree=p.args.mesh_octree_depth,
|
||||||
samples=p.args.mesh_samples,
|
samples=p.args.mesh_samples,
|
||||||
|
@ -124,16 +118,16 @@ class ODMApp(ecto.BlackBox):
|
||||||
self.args[:] >> self.meshing['args'],
|
self.args[:] >> self.meshing['args'],
|
||||||
self.opensfm['reconstruction'] >> self.meshing['reconstruction']]
|
self.opensfm['reconstruction'] >> self.meshing['reconstruction']]
|
||||||
else:
|
else:
|
||||||
# run smvs
|
# run mve
|
||||||
|
|
||||||
connections += [self.tree[:] >> self.smvs['tree'],
|
connections += [self.tree[:] >> self.mve['tree'],
|
||||||
self.args[:] >> self.smvs['args'],
|
self.args[:] >> self.mve['args'],
|
||||||
self.opensfm['reconstruction'] >> self.smvs['reconstruction']]
|
self.opensfm['reconstruction'] >> self.mve['reconstruction']]
|
||||||
|
|
||||||
# create odm mesh from smvs point cloud
|
# create odm mesh from mve point cloud
|
||||||
connections += [self.tree[:] >> self.meshing['tree'],
|
connections += [self.tree[:] >> self.meshing['tree'],
|
||||||
self.args[:] >> self.meshing['args'],
|
self.args[:] >> self.meshing['args'],
|
||||||
self.smvs['reconstruction'] >> self.meshing['reconstruction']]
|
self.mve['reconstruction'] >> self.meshing['reconstruction']]
|
||||||
|
|
||||||
# create odm texture
|
# create odm texture
|
||||||
connections += [self.tree[:] >> self.texturing['tree'],
|
connections += [self.tree[:] >> self.texturing['tree'],
|
||||||
|
@ -164,14 +158,14 @@ class ODMApp(ecto.BlackBox):
|
||||||
connections += [self.tree[:] >> self.slam['tree'],
|
connections += [self.tree[:] >> self.slam['tree'],
|
||||||
self.args[:] >> self.slam['args']]
|
self.args[:] >> self.slam['args']]
|
||||||
|
|
||||||
connections += [self.tree[:] >> self.smvs['tree'],
|
connections += [self.tree[:] >> self.mve['tree'],
|
||||||
self.args[:] >> self.smvs['args'],
|
self.args[:] >> self.mve['args'],
|
||||||
self.slam['reconstruction'] >> self.smvs['reconstruction']]
|
self.slam['reconstruction'] >> self.mve['reconstruction']]
|
||||||
|
|
||||||
# create odm mesh
|
# create odm mesh
|
||||||
connections += [self.tree[:] >> self.meshing['tree'],
|
connections += [self.tree[:] >> self.meshing['tree'],
|
||||||
self.args[:] >> self.meshing['args'],
|
self.args[:] >> self.meshing['args'],
|
||||||
self.smvs['reconstruction'] >> self.meshing['reconstruction']]
|
self.mve['reconstruction'] >> self.meshing['reconstruction']]
|
||||||
|
|
||||||
# create odm texture
|
# create odm texture
|
||||||
connections += [self.tree[:] >> self.texturing['tree'],
|
connections += [self.tree[:] >> self.texturing['tree'],
|
||||||
|
|
|
@ -99,7 +99,7 @@ class ODMGeoreferencingCell(ecto.Cell):
|
||||||
elif args.use_opensfm_dense:
|
elif args.use_opensfm_dense:
|
||||||
kwargs['pc'] = tree.opensfm_model
|
kwargs['pc'] = tree.opensfm_model
|
||||||
else:
|
else:
|
||||||
kwargs['pc'] = tree.smvs_model
|
kwargs['pc'] = tree.mve_model
|
||||||
|
|
||||||
if transformPointCloud:
|
if transformPointCloud:
|
||||||
kwargs['pc_params'] = '-inputPointCloudFile {pc} -outputPointCloudFile {pc_geo}'.format(**kwargs)
|
kwargs['pc_params'] = '-inputPointCloudFile {pc} -outputPointCloudFile {pc_geo}'.format(**kwargs)
|
||||||
|
|
|
@ -49,7 +49,7 @@ class ODMeshingCell(ecto.Cell):
|
||||||
(args.rerun_from is not None and
|
(args.rerun_from is not None and
|
||||||
'odm_meshing' in args.rerun_from)
|
'odm_meshing' in args.rerun_from)
|
||||||
|
|
||||||
infile = tree.smvs_model
|
infile = tree.mve_model
|
||||||
if args.fast_orthophoto:
|
if args.fast_orthophoto:
|
||||||
infile = os.path.join(tree.opensfm, 'reconstruction.ply')
|
infile = os.path.join(tree.opensfm, 'reconstruction.ply')
|
||||||
elif args.use_opensfm_dense:
|
elif args.use_opensfm_dense:
|
||||||
|
|
Ładowanie…
Reference in New Issue