Renamed opensfm-depthmap-resolution to depthmap-resolution, use parameter for both smvs and opensfm

pull/889/head
Piero Toffanin 2018-07-04 14:27:06 -04:00
rodzic f042118b21
commit e44fb3ab99
4 zmienionych plików z 17 dodań i 22 usunięć

Wyświetl plik

@ -148,11 +148,11 @@ def config():
'processes. Peak memory requirement is ~1GB per '
'thread and 2 megapixel image resolution. Default: %(default)s'))
parser.add_argument('--opensfm-depthmap-resolution',
parser.add_argument('--depthmap-resolution',
metavar='<positive float>',
type=float,
default=640,
help=('Resolution of the depthmaps. Higher values take longer to compute '
help=('Controls the density of the point cloud by setting the resolution of the depthmap images. Higher values take longer to compute '
'but produce denser point clouds. '
'Default: %(default)s'))
@ -210,14 +210,6 @@ def config():
help='Regularization parameter, a higher alpha leads to '
'smoother surfaces. Default: %(default)s')
parser.add_argument('--smvs-scale',
metavar='<positive integer>',
default=2,
type=int,
help='Scales the input images, which affects the output'
' density. 0 is original scale but takes longer '
'to process. 2 is 1/4 scale. Default: %(default)s')
parser.add_argument('--smvs-output-scale',
metavar='<positive integer>',
default=2,

Wyświetl plik

@ -50,7 +50,7 @@ class ODMApp(ecto.BlackBox):
hybrid_bundle_adjustment=p.args.use_hybrid_bundle_adjustment),
'slam': ODMSlamCell(),
'smvs': ODMSmvsCell(alpha=p.args.smvs_alpha,
scale=p.args.smvs_scale,
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,

Wyświetl plik

@ -76,7 +76,7 @@ class ODMOpenSfMCell(ecto.Cell):
"processes: %s" % self.params.processes,
"matching_gps_neighbors: %s" % self.params.matching_gps_neighbors,
"depthmap_method: %s" % args.opensfm_depthmap_method,
"depthmap_resolution: %s" % args.opensfm_depthmap_resolution,
"depthmap_resolution: %s" % args.depthmap_resolution,
"depthmap_min_patch_sd: %s" % args.opensfm_depthmap_min_patch_sd,
"depthmap_min_consistent_views: %s" % args.opensfm_depthmap_min_consistent_views,
"optimize_camera_parameters: %s" % ('no' if self.params.fixed_camera_params else 'yes')

Wyświetl plik

@ -1,4 +1,4 @@
import ecto, shutil
import ecto, shutil, os, glob
from opendm import log
from opendm import io
@ -10,7 +10,7 @@ class ODMSmvsCell(ecto.Cell):
def declare_params(self, params):
params.declare("threads", "max number of threads", context.num_cores)
params.declare("alpha", "Regularization parameter", 1)
params.declare("scale", "input scale", 1)
params.declare("max_pixels", "max pixels for reconstruction", 1700000)
params.declare("output_scale", "scale of optimization", 2)
params.declare("shading", "Enable shading-aware model", False)
params.declare("gamma_srgb", "Apply inverse SRGB gamma correction", False)
@ -70,7 +70,7 @@ class ODMSmvsCell(ecto.Cell):
config = [
"-t%s" % self.params.threads,
"-a%s" % self.params.alpha,
"-s%s" % self.params.scale,
"--max-pixels=%s" % self.params.max_pixels,
"-o%s" % self.params.output_scale,
"--debug-lvl=%s" % ('1' if self.params.verbose else '0'),
"%s" % '-S' if self.params.shading else '',
@ -80,13 +80,16 @@ class ODMSmvsCell(ecto.Cell):
# run smvs
system.run('%s %s %s' % (context.smvs_path, ' '.join(config), tree.smvs))
# rename the file for simplicity
old_file = io.join_paths(tree.smvs, 'smvs-%s%s.ply' %
('S' if self.params.shading else 'B', self.params.scale))
if not (io.rename_file(old_file, tree.smvs_model)):
log.ODM_WARNING("File %s does not exist, cannot be renamed. " % old_file)
# find and rename the output file for simplicity
smvs_files = glob.glob('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)):
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)
else:
log.ODM_WARNING('Found a valid SMVS reconstruction file in: %s' %
tree.smvs_model)