Former-commit-id: 8e3a01fbb7
pull/1161/head
Stephen Mather 2018-12-02 17:45:26 +00:00
rodzic dad197ddb7
commit 0a5c938238
10 zmienionych plików z 58 dodań i 64 usunięć

Wyświetl plik

@ -109,7 +109,7 @@ or
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

Wyświetl plik

@ -141,17 +141,17 @@ externalproject_add(mve
INSTALL_COMMAND ""
)
externalproject_add(smvs
DEPENDS mve
GIT_REPOSITORY https://github.com/flanggut/smvs.git
GIT_TAG 6a7d0c095aa66ab98c5b285c2bc04e34d8993353
UPDATE_COMMAND ""
SOURCE_DIR ${SB_SOURCE_DIR}/elibs/smvs
CONFIGURE_COMMAND ""
BUILD_IN_SOURCE 1
BUILD_COMMAND make
INSTALL_COMMAND ""
)
#externalproject_add(smvs
# DEPENDS mve
# GIT_REPOSITORY https://github.com/flanggut/smvs.git
# GIT_TAG 6a7d0c095aa66ab98c5b285c2bc04e34d8993353
# UPDATE_COMMAND ""
# SOURCE_DIR ${SB_SOURCE_DIR}/elibs/smvs
# CONFIGURE_COMMAND ""
# BUILD_IN_SOURCE 1
# BUILD_COMMAND make
# INSTALL_COMMAND ""
#)
externalproject_add(poissonrecon
GIT_REPOSITORY https://github.com/mkazhdan/PoissonRecon.git
@ -182,4 +182,4 @@ externalproject_add(dem2points
BUILD_IN_SOURCE 1
BUILD_COMMAND make
INSTALL_COMMAND ""
)
)

Wyświetl plik

@ -7,7 +7,7 @@ from appsettings import SettingsParser
import sys
# parse arguments
processopts = ['dataset', 'opensfm', 'slam', 'smvs',
processopts = ['dataset', 'opensfm', 'slam', 'mve',
'odm_meshing', 'odm_25dmeshing', 'mvs_texturing', 'odm_georeferencing',
'odm_dem', 'odm_orthophoto']

Wyświetl plik

@ -23,15 +23,15 @@ ccd_widths_path = os.path.join(opensfm_path, 'opensfm/data/sensor_data.json')
# define orb_slam2 path
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
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')
dem2mesh_path = os.path.join(superbuild_path, 'src', 'dem2mesh', 'dem2mesh')
dem2points_path = os.path.join(superbuild_path, 'src', 'dem2points', 'dem2points')
# define mvstex path
mvstex_path = os.path.join(superbuild_path, "install/bin/texrecon")

Wyświetl plik

@ -340,7 +340,7 @@ class ODM_Tree(object):
# whole reconstruction process.
self.dataset_raw = io.join_paths(self.root_path, 'images')
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_texturing = io.join_paths(self.root_path, 'odm_texturing')
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_transformation = io.join_paths(self.opensfm, 'geocoords_transformation.txt')
# smvs
self.smvs_model = io.join_paths(self.smvs, 'smvs_dense_point_cloud.ply')
# mve
self.mve_model = io.join_paths(self.mve, 'mve_dense_point_cloud.ply')
self.mve_path = io.join_paths(self.opensfm, 'mve')
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_views = io.join_paths(self.smvs, 'views')
self.mve_views = io.join_paths(self.mve, 'views')
# odm_meshing
self.odm_mesh = io.join_paths(self.odm_meshing, 'odm_mesh.ply')

2
run.py
Wyświetl plik

@ -33,7 +33,7 @@ if __name__ == '__main__':
+ args.project_path + "/odm_orthophoto "
+ args.project_path + "/odm_texturing "
+ args.project_path + "/opensfm "
+ args.project_path + "/smvs")
+ args.project_path + "/mve")
# create an instance of my App BlackBox
# internally configure all tasks

Wyświetl plik

@ -6,7 +6,7 @@ from opendm import system
from opendm import context
class ODMSmvsCell(ecto.Cell):
class ODMMveCell(ecto.Cell):
def declare_params(self, params):
params.declare("threads", "max number of threads", context.num_cores)
params.declare("alpha", "Regularization parameter", 1)
@ -27,7 +27,7 @@ class ODMSmvsCell(ecto.Cell):
# Benchmarking
start_time = system.now_raw()
log.ODM_INFO('Running SMVS Cell')
log.ODM_INFO('Running MVE Cell')
# get inputs
tree = inputs.tree
@ -36,18 +36,18 @@ class ODMSmvsCell(ecto.Cell):
photos = reconstruction.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
# check if we rerun cell or not
rerun_cell = (args.rerun is not None and
args.rerun == 'smvs') or \
args.rerun == 'mve') or \
(args.rerun_all) or \
(args.rerun_from is not None and
'smvs' in args.rerun_from)
'mve' in args.rerun_from)
# 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
if io.dir_exists(tree.mve_path) and rerun_cell:
shutil.rmtree(tree.mve_path)
@ -62,12 +62,12 @@ class ODMSmvsCell(ecto.Cell):
# mve makescene wants the output directory
# to not exists before executing it (otherwise it
# will prompt the user for confirmation)
if io.dir_exists(tree.smvs):
shutil.rmtree(tree.smvs)
if io.dir_exists(tree.mve):
shutil.rmtree(tree.mve)
# run mve makescene
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 = [
@ -81,26 +81,26 @@ class ODMSmvsCell(ecto.Cell):
"--force" if rerun_cell else ''
]
# run smvs
system.run('%s %s %s' % (context.smvs_path, ' '.join(config), tree.smvs))
# run mve
system.run('%s %s %s' % (context.mve_path, ' '.join(config), tree.mve))
# find and rename the output file for simplicity
smvs_files = glob.glob(os.path.join(tree.smvs, 'smvs-*'))
smvs_files.sort(key=os.path.getmtime) # sort by last modified date
if len(smvs_files) > 0:
old_file = smvs_files[-1]
if not (io.rename_file(old_file, tree.smvs_model)):
mve_files = glob.glob(os.path.join(tree.mve, 'mve-*'))
mve_files.sort(key=os.path.getmtime) # sort by last modified date
if len(mve_files) > 0:
old_file = mve_files[-1]
if not (io.rename_file(old_file, tree.mve_model)):
log.ODM_WARNING("File %s does not exist, cannot be renamed. " % old_file)
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:
log.ODM_WARNING('Found a valid SMVS reconstruction file in: %s' %
tree.smvs_model)
log.ODM_WARNING('Found a valid MVE reconstruction file in: %s' %
tree.mve_model)
outputs.reconstruction = reconstruction
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')
return ecto.OK if args.end_with != 'smvs' else ecto.QUIT
log.ODM_INFO('Running ODM MVE Cell - Finished')
return ecto.OK if args.end_with != 'mve' else ecto.QUIT

Wyświetl plik

@ -8,7 +8,7 @@ from opendm import system
from dataset import ODMLoadDatasetCell
from run_opensfm import ODMOpenSfMCell
from smvs import ODMSmvsCell
from mve import ODMMvsCell
from odm_slam import ODMSlamCell
from odm_meshing import ODMeshingCell
from mvstex import ODMMvsTexCell
@ -49,13 +49,7 @@ class ODMApp(ecto.BlackBox):
fixed_camera_params=p.args.use_fixed_camera_params,
hybrid_bundle_adjustment=p.args.use_hybrid_bundle_adjustment),
'slam': ODMSlamCell(),
'smvs': ODMSmvsCell(alpha=p.args.smvs_alpha,
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),
'mve': ODMMveCell(),
'meshing': ODMeshingCell(max_vertex=p.args.mesh_size,
oct_tree=p.args.mesh_octree_depth,
samples=p.args.mesh_samples,
@ -124,16 +118,16 @@ class ODMApp(ecto.BlackBox):
self.args[:] >> self.meshing['args'],
self.opensfm['reconstruction'] >> self.meshing['reconstruction']]
else:
# run smvs
# run mve
connections += [self.tree[:] >> self.smvs['tree'],
self.args[:] >> self.smvs['args'],
self.opensfm['reconstruction'] >> self.smvs['reconstruction']]
connections += [self.tree[:] >> self.mve['tree'],
self.args[:] >> self.mve['args'],
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'],
self.args[:] >> self.meshing['args'],
self.smvs['reconstruction'] >> self.meshing['reconstruction']]
self.mve['reconstruction'] >> self.meshing['reconstruction']]
# create odm texture
connections += [self.tree[:] >> self.texturing['tree'],
@ -164,14 +158,14 @@ class ODMApp(ecto.BlackBox):
connections += [self.tree[:] >> self.slam['tree'],
self.args[:] >> self.slam['args']]
connections += [self.tree[:] >> self.smvs['tree'],
self.args[:] >> self.smvs['args'],
self.slam['reconstruction'] >> self.smvs['reconstruction']]
connections += [self.tree[:] >> self.mve['tree'],
self.args[:] >> self.mve['args'],
self.slam['reconstruction'] >> self.mve['reconstruction']]
# create odm mesh
connections += [self.tree[:] >> self.meshing['tree'],
self.args[:] >> self.meshing['args'],
self.smvs['reconstruction'] >> self.meshing['reconstruction']]
self.mve['reconstruction'] >> self.meshing['reconstruction']]
# create odm texture
connections += [self.tree[:] >> self.texturing['tree'],

Wyświetl plik

@ -99,7 +99,7 @@ class ODMGeoreferencingCell(ecto.Cell):
elif args.use_opensfm_dense:
kwargs['pc'] = tree.opensfm_model
else:
kwargs['pc'] = tree.smvs_model
kwargs['pc'] = tree.mve_model
if transformPointCloud:
kwargs['pc_params'] = '-inputPointCloudFile {pc} -outputPointCloudFile {pc_geo}'.format(**kwargs)

Wyświetl plik

@ -49,7 +49,7 @@ class ODMeshingCell(ecto.Cell):
(args.rerun_from is not None and
'odm_meshing' in args.rerun_from)
infile = tree.smvs_model
infile = tree.mve_model
if args.fast_orthophoto:
infile = os.path.join(tree.opensfm, 'reconstruction.ply')
elif args.use_opensfm_dense: