kopia lustrzana https://github.com/OpenDroneMap/ODM
Adapt to the removed resize step
rodzic
4bacaf5c7c
commit
2e59dfab6b
|
@ -8,7 +8,7 @@ from appsettings import SettingsParser
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
# parse arguments
|
# parse arguments
|
||||||
processopts = ['resize', 'opensfm', 'slam', 'cmvs', 'pmvs',
|
processopts = ['dataset', 'opensfm', 'slam', 'cmvs', 'pmvs',
|
||||||
'odm_meshing', 'odm_25dmeshing', 'mvs_texturing', 'odm_georeferencing',
|
'odm_meshing', 'odm_25dmeshing', 'mvs_texturing', 'odm_georeferencing',
|
||||||
'odm_dem', 'odm_orthophoto']
|
'odm_dem', 'odm_orthophoto']
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ def config():
|
||||||
type=int,
|
type=int,
|
||||||
help=('The maximum number of processes to use in dense '
|
help=('The maximum number of processes to use in dense '
|
||||||
'reconstruction. Default: %(default)s'))
|
'reconstruction. Default: %(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--use-25dmesh',
|
parser.add_argument('--use-25dmesh',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
default=False,
|
default=False,
|
||||||
|
@ -242,7 +242,7 @@ def config():
|
||||||
'Increasing this value increases computation '
|
'Increasing this value increases computation '
|
||||||
'times slightly but helps reduce memory usage. '
|
'times slightly but helps reduce memory usage. '
|
||||||
'Default: %(default)s'))
|
'Default: %(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--mesh-remove-outliers',
|
parser.add_argument('--mesh-remove-outliers',
|
||||||
metavar='<percent>',
|
metavar='<percent>',
|
||||||
default=2,
|
default=2,
|
||||||
|
@ -271,8 +271,8 @@ def config():
|
||||||
metavar='<string>',
|
metavar='<string>',
|
||||||
default='gauss_clamping',
|
default='gauss_clamping',
|
||||||
choices=['none', 'gauss_clamping', 'gauss_damping'],
|
choices=['none', 'gauss_clamping', 'gauss_damping'],
|
||||||
help=('Type of photometric outlier removal method: '
|
help=('Type of photometric outlier removal method: '
|
||||||
'[none, gauss_damping, gauss_clamping]. Default: '
|
'[none, gauss_damping, gauss_clamping]. Default: '
|
||||||
'%(default)s'))
|
'%(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--texturing-skip-visibility-test',
|
parser.add_argument('--texturing-skip-visibility-test',
|
||||||
|
@ -301,7 +301,7 @@ def config():
|
||||||
parser.add_argument('--texturing-keep-unseen-faces',
|
parser.add_argument('--texturing-keep-unseen-faces',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
default=False,
|
default=False,
|
||||||
help=('Keep faces in the mesh that are not seen in any camera. '
|
help=('Keep faces in the mesh that are not seen in any camera. '
|
||||||
'Default: %(default)s'))
|
'Default: %(default)s'))
|
||||||
|
|
||||||
parser.add_argument('--texturing-tone-mapping',
|
parser.add_argument('--texturing-tone-mapping',
|
||||||
|
@ -332,7 +332,7 @@ def config():
|
||||||
default=False,
|
default=False,
|
||||||
help='Use this tag to build a DTM (Digital Terrain Model, ground only) using a progressive '
|
help='Use this tag to build a DTM (Digital Terrain Model, ground only) using a progressive '
|
||||||
'morphological filter. Check the --dem* parameters for fine tuning.')
|
'morphological filter. Check the --dem* parameters for fine tuning.')
|
||||||
|
|
||||||
parser.add_argument('--dsm',
|
parser.add_argument('--dsm',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
default=False,
|
default=False,
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
import os
|
import os
|
||||||
import ecto
|
import ecto
|
||||||
|
|
||||||
from functools import partial
|
|
||||||
from multiprocessing import Pool
|
|
||||||
from opendm import context
|
from opendm import context
|
||||||
from opendm import io
|
from opendm import io
|
||||||
from opendm import types
|
from opendm import types
|
||||||
|
@ -27,6 +25,7 @@ class ODMLoadDatasetCell(ecto.Cell):
|
||||||
|
|
||||||
def declare_io(self, params, inputs, outputs):
|
def declare_io(self, params, inputs, outputs):
|
||||||
inputs.declare("tree", "Struct with paths", [])
|
inputs.declare("tree", "Struct with paths", [])
|
||||||
|
inputs.declare("args", "The application arguments.", {})
|
||||||
outputs.declare("photos", "list of ODMPhotos", [])
|
outputs.declare("photos", "list of ODMPhotos", [])
|
||||||
|
|
||||||
def process(self, inputs, outputs):
|
def process(self, inputs, outputs):
|
||||||
|
@ -45,6 +44,7 @@ class ODMLoadDatasetCell(ecto.Cell):
|
||||||
|
|
||||||
# get inputs
|
# get inputs
|
||||||
tree = self.inputs.tree
|
tree = self.inputs.tree
|
||||||
|
args = self.inputs.args
|
||||||
|
|
||||||
# get images directory
|
# get images directory
|
||||||
input_dir = tree.input_images
|
input_dir = tree.input_images
|
||||||
|
@ -70,8 +70,8 @@ class ODMLoadDatasetCell(ecto.Cell):
|
||||||
photos = []
|
photos = []
|
||||||
for files in path_files:
|
for files in path_files:
|
||||||
photos += [make_odm_photo(self.params.force_focal, self.params.force_ccd, files)]
|
photos += [make_odm_photo(self.params.force_focal, self.params.force_ccd, files)]
|
||||||
|
|
||||||
log.ODM_INFO('Found %s usable images' % len(photos))
|
log.ODM_INFO('Found %s usable images' % len(photos))
|
||||||
else:
|
else:
|
||||||
log.ODM_ERROR('Not enough supported images in %s' % images_dir)
|
log.ODM_ERROR('Not enough supported images in %s' % images_dir)
|
||||||
return ecto.QUIT
|
return ecto.QUIT
|
||||||
|
@ -80,4 +80,4 @@ class ODMLoadDatasetCell(ecto.Cell):
|
||||||
outputs.photos = photos
|
outputs.photos = photos
|
||||||
|
|
||||||
log.ODM_INFO('Running ODM Load Dataset Cell - Finished')
|
log.ODM_INFO('Running ODM Load Dataset Cell - Finished')
|
||||||
return ecto.OK
|
return ecto.OK if args.end_with != 'dataset' else ecto.QUIT
|
||||||
|
|
|
@ -27,13 +27,13 @@ def run_command(args):
|
||||||
|
|
||||||
def resize_images(data_path, args):
|
def resize_images(data_path, args):
|
||||||
command = os.path.join(context.root_path, 'run.py')
|
command = os.path.join(context.root_path, 'run.py')
|
||||||
path, name = os.path.split(data_path)
|
path, name = os.path.split(data_path.rstrip('/'))
|
||||||
run_command(['python',
|
run_command(['python',
|
||||||
command,
|
command,
|
||||||
'--project-path', path,
|
'--project-path', path,
|
||||||
name,
|
name,
|
||||||
'--resize-to', str(args.resize_to),
|
'--resize-to', str(args.resize_to),
|
||||||
'--end-with', 'resize',
|
'--end-with', 'dataset',
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ def create_config(opensfm_path, args):
|
||||||
config = {
|
config = {
|
||||||
"submodels_relpath": "../submodels/opensfm",
|
"submodels_relpath": "../submodels/opensfm",
|
||||||
"submodel_relpath_template": "../submodels/submodel_%04d/opensfm",
|
"submodel_relpath_template": "../submodels/submodel_%04d/opensfm",
|
||||||
"submodel_images_relpath_template": "../submodels/submodel_%04d/images_resize",
|
"submodel_images_relpath_template": "../submodels/submodel_%04d/images",
|
||||||
|
|
||||||
"feature_process_size": args.resize_to,
|
"feature_process_size": args.resize_to,
|
||||||
"feature_min_frames": args.min_num_features,
|
"feature_min_frames": args.min_num_features,
|
||||||
|
@ -118,7 +118,7 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
resize_images(data_path, args)
|
resize_images(data_path, args)
|
||||||
|
|
||||||
image_path = os.path.join(data_path, 'images_resize')
|
image_path = os.path.join(data_path, 'images')
|
||||||
opensfm_path = os.path.join(data_path, 'opensfm')
|
opensfm_path = os.path.join(data_path, 'opensfm')
|
||||||
|
|
||||||
mkdir_p(opensfm_path)
|
mkdir_p(opensfm_path)
|
||||||
|
|
|
@ -107,7 +107,8 @@ class ODMApp(ecto.BlackBox):
|
||||||
# define the connections like you would for the plasm
|
# define the connections like you would for the plasm
|
||||||
|
|
||||||
# load the dataset
|
# load the dataset
|
||||||
connections = [self.tree[:] >> self.dataset['tree']]
|
connections = [self.tree[:] >> self.dataset['tree'],
|
||||||
|
self.args[:] >> self.dataset['args']]
|
||||||
|
|
||||||
# run opensfm with images from load dataset
|
# run opensfm with images from load dataset
|
||||||
connections += [self.tree[:] >> self.opensfm['tree'],
|
connections += [self.tree[:] >> self.opensfm['tree'],
|
||||||
|
@ -134,7 +135,7 @@ class ODMApp(ecto.BlackBox):
|
||||||
connections += [self.tree[:] >> self.meshing['tree'],
|
connections += [self.tree[:] >> self.meshing['tree'],
|
||||||
self.args[:] >> self.meshing['args'],
|
self.args[:] >> self.meshing['args'],
|
||||||
self.pmvs['reconstruction'] >> self.meshing['reconstruction']]
|
self.pmvs['reconstruction'] >> self.meshing['reconstruction']]
|
||||||
|
|
||||||
# create odm texture
|
# create odm texture
|
||||||
connections += [self.tree[:] >> self.texturing['tree'],
|
connections += [self.tree[:] >> self.texturing['tree'],
|
||||||
self.args[:] >> self.texturing['args'],
|
self.args[:] >> self.texturing['args'],
|
||||||
|
@ -145,12 +146,12 @@ class ODMApp(ecto.BlackBox):
|
||||||
self.args[:] >> self.georeferencing['args'],
|
self.args[:] >> self.georeferencing['args'],
|
||||||
self.dataset['photos'] >> self.georeferencing['photos'],
|
self.dataset['photos'] >> self.georeferencing['photos'],
|
||||||
self.texturing['reconstruction'] >> self.georeferencing['reconstruction']]
|
self.texturing['reconstruction'] >> self.georeferencing['reconstruction']]
|
||||||
|
|
||||||
# create odm dem
|
# create odm dem
|
||||||
connections += [self.tree[:] >> self.dem['tree'],
|
connections += [self.tree[:] >> self.dem['tree'],
|
||||||
self.args[:] >> self.dem['args'],
|
self.args[:] >> self.dem['args'],
|
||||||
self.georeferencing['reconstruction'] >> self.dem['reconstruction']]
|
self.georeferencing['reconstruction'] >> self.dem['reconstruction']]
|
||||||
|
|
||||||
# create odm orthophoto
|
# create odm orthophoto
|
||||||
connections += [self.tree[:] >> self.orthophoto['tree'],
|
connections += [self.tree[:] >> self.orthophoto['tree'],
|
||||||
self.args[:] >> self.orthophoto['args'],
|
self.args[:] >> self.orthophoto['args'],
|
||||||
|
|
Ładowanie…
Reference in New Issue