kopia lustrzana https://github.com/OpenDroneMap/ODM
Use Namespace instead of Dict for argparse
rodzic
1d1459090c
commit
97bccd3cb4
467
opendm/config.py
467
opendm/config.py
|
@ -13,274 +13,279 @@ class RerunFrom(argparse.Action):
|
|||
|
||||
|
||||
parser = argparse.ArgumentParser(description='OpenDroneMap')
|
||||
parser.add_argument('--project-path',
|
||||
metavar='<string>',
|
||||
help='Path to the project to process')
|
||||
|
||||
parser.add_argument('--resize-to', # currently doesn't support 'orig'
|
||||
metavar='<integer>',
|
||||
default=2400,
|
||||
type=int,
|
||||
help='resizes images by the largest side')
|
||||
|
||||
parser.add_argument('--start-with', '-s',
|
||||
metavar='<string>',
|
||||
default='resize',
|
||||
choices=processopts,
|
||||
help=('Can be one of: ' + ' | '.join(processopts)))
|
||||
def config():
|
||||
parser.add_argument('--project-path',
|
||||
metavar='<string>',
|
||||
help='Path to the project to process')
|
||||
|
||||
parser.add_argument('--end-with', '-e',
|
||||
metavar='<string>',
|
||||
default='odm_orthophoto',
|
||||
choices=processopts,
|
||||
help=('Can be one of:' + ' | '.join(processopts)))
|
||||
parser.add_argument('--resize-to', # currently doesn't support 'orig'
|
||||
metavar='<integer>',
|
||||
default=2400,
|
||||
type=int,
|
||||
help='resizes images by the largest side')
|
||||
|
||||
rerun = parser.add_mutually_exclusive_group()
|
||||
parser.add_argument('--start-with', '-s',
|
||||
metavar='<string>',
|
||||
default='resize',
|
||||
choices=processopts,
|
||||
help=('Can be one of: ' + ' | '.join(processopts)))
|
||||
|
||||
rerun.add_argument('--rerun', '-r',
|
||||
metavar='<string>',
|
||||
choices=processopts,
|
||||
help=('Can be one of:' + ' | '.join(processopts)))
|
||||
parser.add_argument('--end-with', '-e',
|
||||
metavar='<string>',
|
||||
default='odm_orthophoto',
|
||||
choices=processopts,
|
||||
help=('Can be one of:' + ' | '.join(processopts)))
|
||||
|
||||
rerun.add_argument('--rerun-all',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='force rerun of all tasks')
|
||||
rerun = parser.add_mutually_exclusive_group()
|
||||
|
||||
rerun.add_argument('--rerun-from',
|
||||
action=RerunFrom,
|
||||
metavar='<string>',
|
||||
choices=processopts,
|
||||
help=('Can be one of:' + ' | '.join(processopts)))
|
||||
rerun.add_argument('--rerun', '-r',
|
||||
metavar='<string>',
|
||||
choices=processopts,
|
||||
help=('Can be one of:' + ' | '.join(processopts)))
|
||||
|
||||
parser.add_argument('--force-focal',
|
||||
metavar='<positive float>',
|
||||
type=float,
|
||||
help=('Override the focal length information for the '
|
||||
'images'))
|
||||
rerun.add_argument('--rerun-all',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='force rerun of all tasks')
|
||||
|
||||
parser.add_argument('--force-ccd',
|
||||
metavar='<positive float>',
|
||||
type=float,
|
||||
help='Override the ccd width information for the images')
|
||||
rerun.add_argument('--rerun-from',
|
||||
action=RerunFrom,
|
||||
metavar='<string>',
|
||||
choices=processopts,
|
||||
help=('Can be one of:' + ' | '.join(processopts)))
|
||||
|
||||
parser.add_argument('--min-num-features',
|
||||
metavar='<integer>',
|
||||
default=4000,
|
||||
type=int,
|
||||
help=('Minimum number of features to extract per image. '
|
||||
'More features leads to better results but slower '
|
||||
'execution. Default: %(default)s'))
|
||||
parser.add_argument('--force-focal',
|
||||
metavar='<positive float>',
|
||||
type=float,
|
||||
help=('Override the focal length information for the '
|
||||
'images'))
|
||||
|
||||
parser.add_argument('--matcher-threshold',
|
||||
metavar='<percent>',
|
||||
default=2.0,
|
||||
type=float,
|
||||
help=('Ignore matched keypoints if the two images share '
|
||||
'less than <float> percent of keypoints. Default:'
|
||||
' $(default)s'))
|
||||
parser.add_argument('--force-ccd',
|
||||
metavar='<positive float>',
|
||||
type=float,
|
||||
help='Override the ccd width information for the images')
|
||||
|
||||
parser.add_argument('--matcher-ratio',
|
||||
metavar='<float>',
|
||||
default=0.6,
|
||||
type=float,
|
||||
help=('Ratio of the distance to the next best matched '
|
||||
'keypoint. Default: %(default)s'))
|
||||
parser.add_argument('--min-num-features',
|
||||
metavar='<integer>',
|
||||
default=4000,
|
||||
type=int,
|
||||
help=('Minimum number of features to extract per image. '
|
||||
'More features leads to better results but slower '
|
||||
'execution. Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--matcher-neighbors',
|
||||
type=int,
|
||||
metavar='<integer>',
|
||||
default=8,
|
||||
help='Number of nearest images to pre-match based on GPS '
|
||||
'exif data. Set to 0 to skip pre-matching. '
|
||||
'Neighbors works together with Distance parameter, '
|
||||
'set both to 0 to not use pre-matching. OpenSFM '
|
||||
'uses both parameters at the same time, Bundler '
|
||||
'uses only one which has value, prefering the '
|
||||
'Neighbors parameter. Default: %(default)s')
|
||||
parser.add_argument('--matcher-threshold',
|
||||
metavar='<percent>',
|
||||
default=2.0,
|
||||
type=float,
|
||||
help=('Ignore matched keypoints if the two images share '
|
||||
'less than <float> percent of keypoints. Default:'
|
||||
' $(default)s'))
|
||||
|
||||
parser.add_argument('--matcher-distance',
|
||||
metavar='<integer>',
|
||||
default=0,
|
||||
type=int,
|
||||
help='Distance threshold in meters to find pre-matching '
|
||||
'images based on GPS exif data. Set to 0 to skip '
|
||||
'pre-matching. Default: %(default)s')
|
||||
parser.add_argument('--matcher-ratio',
|
||||
metavar='<float>',
|
||||
default=0.6,
|
||||
type=float,
|
||||
help=('Ratio of the distance to the next best matched '
|
||||
'keypoint. Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--cmvs-maxImages',
|
||||
metavar='<integer>',
|
||||
default=500,
|
||||
type=int,
|
||||
help='The maximum number of images per cluster. '
|
||||
'Default: %(default)s')
|
||||
parser.add_argument('--matcher-neighbors',
|
||||
type=int,
|
||||
metavar='<integer>',
|
||||
default=8,
|
||||
help='Number of nearest images to pre-match based on GPS '
|
||||
'exif data. Set to 0 to skip pre-matching. '
|
||||
'Neighbors works together with Distance parameter, '
|
||||
'set both to 0 to not use pre-matching. OpenSFM '
|
||||
'uses both parameters at the same time, Bundler '
|
||||
'uses only one which has value, prefering the '
|
||||
'Neighbors parameter. Default: %(default)s')
|
||||
|
||||
parser.add_argument('--pmvs-level',
|
||||
metavar='<positive integer>',
|
||||
default=1,
|
||||
type=int,
|
||||
help=('The level in the image pyramid that is used '
|
||||
'for the computation. see '
|
||||
'http://www.di.ens.fr/pmvs/documentation.html for '
|
||||
'more pmvs documentation. Default: %(default)s'))
|
||||
parser.add_argument('--matcher-distance',
|
||||
metavar='<integer>',
|
||||
default=0,
|
||||
type=int,
|
||||
help='Distance threshold in meters to find pre-matching '
|
||||
'images based on GPS exif data. Set to 0 to skip '
|
||||
'pre-matching. Default: %(default)s')
|
||||
|
||||
parser.add_argument('--pmvs-csize',
|
||||
metavar='< positive integer>',
|
||||
default=2,
|
||||
type=int,
|
||||
help='Cell size controls the density of reconstructions'
|
||||
'Default: %(default)s')
|
||||
parser.add_argument('--cmvs-maxImages',
|
||||
metavar='<integer>',
|
||||
default=500,
|
||||
type=int,
|
||||
help='The maximum number of images per cluster. '
|
||||
'Default: %(default)s')
|
||||
|
||||
parser.add_argument('--pmvs-threshold',
|
||||
metavar='<float: -1.0 <= x <= 1.0>',
|
||||
default=0.7,
|
||||
type=float,
|
||||
help=('A patch reconstruction is accepted as a success '
|
||||
'and kept if its associated photometric consistency '
|
||||
'measure is above this threshold. Default: %(default)s'))
|
||||
parser.add_argument('--pmvs-level',
|
||||
metavar='<positive integer>',
|
||||
default=1,
|
||||
type=int,
|
||||
help=('The level in the image pyramid that is used '
|
||||
'for the computation. see '
|
||||
'http://www.di.ens.fr/pmvs/documentation.html for '
|
||||
'more pmvs documentation. Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--pmvs-wsize',
|
||||
metavar='<positive integer>',
|
||||
default=7,
|
||||
type=int,
|
||||
help='pmvs samples wsize x wsize pixel colors from '
|
||||
'each image to compute photometric consistency '
|
||||
'score. For example, when wsize=7, 7x7=49 pixel '
|
||||
'colors are sampled in each image. Increasing the '
|
||||
'value leads to more stable reconstructions, but '
|
||||
'the program becomes slower. Default: %(default)s')
|
||||
parser.add_argument('--pmvs-csize',
|
||||
metavar='< positive integer>',
|
||||
default=2,
|
||||
type=int,
|
||||
help='Cell size controls the density of reconstructions'
|
||||
'Default: %(default)s')
|
||||
|
||||
parser.add_argument('--pmvs-minImageNum',
|
||||
metavar='<positive integer>',
|
||||
default=3,
|
||||
type=int,
|
||||
help=('Each 3D point must be visible in at least '
|
||||
'minImageNum images for being reconstructed. 3 is '
|
||||
'suggested in general. Default: %(default)s'))
|
||||
parser.add_argument('--pmvs-threshold',
|
||||
metavar='<float: -1.0 <= x <= 1.0>',
|
||||
default=0.7,
|
||||
type=float,
|
||||
help=('A patch reconstruction is accepted as a success '
|
||||
'and kept if its associated photometric consistency '
|
||||
'measure is above this threshold. Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--pmvs-num-cores',
|
||||
metavar='<positive integer>',
|
||||
default=context.num_cores,
|
||||
type=int,
|
||||
help=('The maximum number of cores to use in dense '
|
||||
'reconstruction. Default: %(default)s'))
|
||||
parser.add_argument('--pmvs-wsize',
|
||||
metavar='<positive integer>',
|
||||
default=7,
|
||||
type=int,
|
||||
help='pmvs samples wsize x wsize pixel colors from '
|
||||
'each image to compute photometric consistency '
|
||||
'score. For example, when wsize=7, 7x7=49 pixel '
|
||||
'colors are sampled in each image. Increasing the '
|
||||
'value leads to more stable reconstructions, but '
|
||||
'the program becomes slower. Default: %(default)s')
|
||||
|
||||
parser.add_argument('--odm_meshing-maxVertexCount',
|
||||
metavar='<positive integer>',
|
||||
default=100000,
|
||||
type=int,
|
||||
help=('The maximum vertex count of the output mesh '
|
||||
'Default: %(default)s'))
|
||||
parser.add_argument('--pmvs-minImageNum',
|
||||
metavar='<positive integer>',
|
||||
default=3,
|
||||
type=int,
|
||||
help=('Each 3D point must be visible in at least '
|
||||
'minImageNum images for being reconstructed. 3 is '
|
||||
'suggested in general. Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--odm_meshing-octreeDepth',
|
||||
metavar='<positive integer>',
|
||||
default=9,
|
||||
type=int,
|
||||
help=('Oct-tree depth used in the mesh reconstruction, '
|
||||
'increase to get more vertices, recommended '
|
||||
'values are 8-12. Default: %(default)s'))
|
||||
parser.add_argument('--pmvs-num-cores',
|
||||
metavar='<positive integer>',
|
||||
default=context.num_cores,
|
||||
type=int,
|
||||
help=('The maximum number of cores to use in dense '
|
||||
'reconstruction. Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--odm_meshing-samplesPerNode',
|
||||
metavar='<float >= 1.0>',
|
||||
default=1.0,
|
||||
type=float,
|
||||
help=('Number of points per octree node, recommended '
|
||||
'and default value: %(default)s'))
|
||||
parser.add_argument('--odm_meshing-maxVertexCount',
|
||||
metavar='<positive integer>',
|
||||
default=100000,
|
||||
type=int,
|
||||
help=('The maximum vertex count of the output mesh '
|
||||
'Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--odm_meshing-solverDivide',
|
||||
metavar='<positive integer>',
|
||||
default=9,
|
||||
type=int,
|
||||
help=('Oct-tree depth at which the Laplacian equation '
|
||||
'is solved in the surface reconstruction step. '
|
||||
'Increasing this value increases computation '
|
||||
'times slightly but helps reduce memory usage. '
|
||||
'Default: %(default)s'))
|
||||
parser.add_argument('--odm_meshing-octreeDepth',
|
||||
metavar='<positive integer>',
|
||||
default=9,
|
||||
type=int,
|
||||
help=('Oct-tree depth used in the mesh reconstruction, '
|
||||
'increase to get more vertices, recommended '
|
||||
'values are 8-12. Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--mvs_texturing-dataTerm',
|
||||
metavar='<string>',
|
||||
default='gmi',
|
||||
help=('Data term: [area, gmi]. Default: %(default)s'))
|
||||
parser.add_argument('--odm_meshing-samplesPerNode',
|
||||
metavar='<float >= 1.0>',
|
||||
default=1.0,
|
||||
type=float,
|
||||
help=('Number of points per octree node, recommended '
|
||||
'and default value: %(default)s'))
|
||||
|
||||
parser.add_argument('--mvs_texturing-outlierRemovalType',
|
||||
metavar='<string>',
|
||||
default='none',
|
||||
help=('Type of photometric outlier removal method: '
|
||||
'[none, gauss_damping, gauss_clamping]. Default: '
|
||||
'%(default)s'))
|
||||
parser.add_argument('--odm_meshing-solverDivide',
|
||||
metavar='<positive integer>',
|
||||
default=9,
|
||||
type=int,
|
||||
help=('Oct-tree depth at which the Laplacian equation '
|
||||
'is solved in the surface reconstruction step. '
|
||||
'Increasing this value increases computation '
|
||||
'times slightly but helps reduce memory usage. '
|
||||
'Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--mvs_texturing-skipGeometricVisibilityTest',
|
||||
metavar='<string>',
|
||||
default="false",
|
||||
help=('Skip geometric visibility test. Default: %(default)s'))
|
||||
parser.add_argument('--mvs_texturing-dataTerm',
|
||||
metavar='<string>',
|
||||
default='gmi',
|
||||
help=('Data term: [area, gmi]. Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--mvs_texturing-skipGlobalSeamLeveling',
|
||||
metavar='<string>',
|
||||
default="false",
|
||||
help=('Skip geometric visibility test. Default: %(default)s'))
|
||||
parser.add_argument('--mvs_texturing-outlierRemovalType',
|
||||
metavar='<string>',
|
||||
default='none',
|
||||
help=('Type of photometric outlier removal method: '
|
||||
'[none, gauss_damping, gauss_clamping]. Default: '
|
||||
'%(default)s'))
|
||||
|
||||
parser.add_argument('--mvs_texturing-skipLocalSeamLeveling',
|
||||
metavar='<string>',
|
||||
default="false",
|
||||
help=('Skip local seam blending. Default: %(default)s'))
|
||||
parser.add_argument('--mvs_texturing-skipGeometricVisibilityTest',
|
||||
metavar='<string>',
|
||||
default="false",
|
||||
help=('Skip geometric visibility test. Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--mvs_texturing-skipHoleFilling',
|
||||
metavar='<string>',
|
||||
default="false",
|
||||
help=('Skip filling of holes in the mesh. Default: %(default)s'))
|
||||
parser.add_argument('--mvs_texturing-skipGlobalSeamLeveling',
|
||||
metavar='<string>',
|
||||
default="false",
|
||||
help=('Skip geometric visibility test. Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--mvs_texturing-keepUnseenFaces',
|
||||
metavar='<string>',
|
||||
default="false",
|
||||
help=('Keep faces in the mesh that are not seen in any camera. '
|
||||
'Default: %(default)s'))
|
||||
parser.add_argument('--mvs_texturing-skipLocalSeamLeveling',
|
||||
metavar='<string>',
|
||||
default="false",
|
||||
help=('Skip local seam blending. Default: %(default)s'))
|
||||
|
||||
# Old odm_texturing arguments
|
||||
parser.add_argument('--odm_texturing-textureResolution',
|
||||
metavar='<positive integer>',
|
||||
default=4096,
|
||||
type=int,
|
||||
help=('The resolution of the output textures. Must be '
|
||||
'greater than textureWithSize. Default: %(default)s'))
|
||||
parser.add_argument('--mvs_texturing-skipHoleFilling',
|
||||
metavar='<string>',
|
||||
default="false",
|
||||
help=('Skip filling of holes in the mesh. Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--odm_texturing-textureWithSize',
|
||||
metavar='<positive integer>',
|
||||
default=3600,
|
||||
type=int,
|
||||
help=('The resolution to rescale the images performing '
|
||||
'the texturing. Default: %(default)s'))
|
||||
# End of old odm_texturing arguments
|
||||
parser.add_argument('--mvs_texturing-keepUnseenFaces',
|
||||
metavar='<string>',
|
||||
default="false",
|
||||
help=('Keep faces in the mesh that are not seen in any camera. '
|
||||
'Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--odm_georeferencing-gcpFile',
|
||||
metavar='<path string>',
|
||||
default='gcp_list.txt',
|
||||
help=('path to the file containing the ground control '
|
||||
'points used for georeferencing. Default: '
|
||||
'%(default)s. The file needs to '
|
||||
'be on the following line format: \neasting '
|
||||
'northing height pixelrow pixelcol imagename'))
|
||||
# Old odm_texturing arguments
|
||||
|
||||
parser.add_argument('--odm_georeferencing-useGcp',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Enabling GCPs from the file above. The GCP file '
|
||||
'is not used by default.')
|
||||
parser.add_argument('--odm_texturing-textureResolution',
|
||||
metavar='<positive integer>',
|
||||
default=4096,
|
||||
type=int,
|
||||
help=('The resolution of the output textures. Must be '
|
||||
'greater than textureWithSize. Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--odm_orthophoto-resolution',
|
||||
metavar='<float > 0.0>',
|
||||
default=20.0,
|
||||
type=float,
|
||||
help=('Orthophoto ground resolution in pixels/meter'
|
||||
'Default: %(default)s'))
|
||||
parser.add_argument('--odm_texturing-textureWithSize',
|
||||
metavar='<positive integer>',
|
||||
default=3600,
|
||||
type=int,
|
||||
help=('The resolution to rescale the images performing '
|
||||
'the texturing. Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--zip-results',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='compress the results using gunzip')
|
||||
# End of old odm_texturing arguments
|
||||
|
||||
parser.add_argument('--time',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Generates a benchmark file with runtime info\n'
|
||||
'Default: %(default)s')
|
||||
parser.add_argument('--odm_georeferencing-gcpFile',
|
||||
metavar='<path string>',
|
||||
default='gcp_list.txt',
|
||||
help=('path to the file containing the ground control '
|
||||
'points used for georeferencing. Default: '
|
||||
'%(default)s. The file needs to '
|
||||
'be on the following line format: \neasting '
|
||||
'northing height pixelrow pixelcol imagename'))
|
||||
|
||||
args = vars(parser.parse_args())
|
||||
parser.add_argument('--odm_georeferencing-useGcp',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Enabling GCPs from the file above. The GCP file '
|
||||
'is not used by default.')
|
||||
|
||||
parser.add_argument('--odm_orthophoto-resolution',
|
||||
metavar='<float > 0.0>',
|
||||
default=20.0,
|
||||
type=float,
|
||||
help=('Orthophoto ground resolution in pixels/meter'
|
||||
'Default: %(default)s'))
|
||||
|
||||
parser.add_argument('--zip-results',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='compress the results using gunzip')
|
||||
|
||||
parser.add_argument('--time',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='Generates a benchmark file with runtime info\n'
|
||||
'Default: %(default)s')
|
||||
|
||||
return parser.parse_args()
|
||||
|
|
6
run.py
6
run.py
|
@ -20,13 +20,15 @@ if __name__ == '__main__':
|
|||
|
||||
log.ODM_INFO('Initializing OpenDroneMap app - %s' % system.now())
|
||||
|
||||
args = config.config()
|
||||
|
||||
# Force to provide the images path
|
||||
if config.args.get('project_path') is None:
|
||||
if args.project_path is None:
|
||||
usage()
|
||||
|
||||
# create an instance of my App BlackBox
|
||||
# internally configure all tasks
|
||||
app = ODMApp(args=config.args)
|
||||
app = ODMApp(args=args)
|
||||
|
||||
# create a plasm that only contains the BlackBox
|
||||
plasm = ecto.Plasm()
|
||||
|
|
|
@ -25,21 +25,21 @@ class ODMCmvsCell(ecto.Cell):
|
|||
# Benchmarking
|
||||
start_time = system.now_raw()
|
||||
|
||||
log.ODM_INFO('Running OMD CMVS Cell')
|
||||
log.ODM_INFO('Running ODM CMVS Cell')
|
||||
|
||||
# get inputs
|
||||
args = self.inputs.args
|
||||
tree = self.inputs.tree
|
||||
|
||||
# check if we rerun cell or not
|
||||
rerun_cell = (args['rerun'] is not None and
|
||||
args['rerun'] == 'cmvs') or \
|
||||
(args['rerun_all']) or \
|
||||
(args['rerun_from'] is not None and
|
||||
'cmvs' in args['rerun_from'])
|
||||
rerun_cell = (args.rerun is not None and
|
||||
args.rerun == 'cmvs') or \
|
||||
(args.rerun_all) or \
|
||||
(args.rerun_from is not None and
|
||||
'cmvs' in args.rerun_from)
|
||||
|
||||
if not io.file_exists(tree.pmvs_bundle) or rerun_cell:
|
||||
log.ODM_DEBUG('Writting CMVS vis in: %s' % tree.pmvs_bundle)
|
||||
log.ODM_DEBUG('Writing CMVS vis in: %s' % tree.pmvs_bundle)
|
||||
|
||||
# copy bundle file to pmvs dir
|
||||
from shutil import copyfile
|
||||
|
@ -59,8 +59,8 @@ class ODMCmvsCell(ecto.Cell):
|
|||
log.ODM_WARNING('Found a valid CMVS file in: %s' %
|
||||
tree.pmvs_bundle)
|
||||
|
||||
if args['time']:
|
||||
if args.time:
|
||||
system.benchmark(start_time, tree.benchmarking, 'CMVS')
|
||||
|
||||
log.ODM_INFO('Running OMD CMVS Cell - Finished')
|
||||
return ecto.OK if args['end_with'] != 'cmvs' else ecto.QUIT
|
||||
log.ODM_INFO('Running ODM CMVS Cell - Finished')
|
||||
return ecto.OK if args.end_with != 'cmvs' else ecto.QUIT
|
||||
|
|
|
@ -38,52 +38,54 @@ class ODMApp(ecto.BlackBox):
|
|||
Only cells from which something is forwarded have to be declared
|
||||
"""
|
||||
cells = {'args': ecto.Constant(value=p.args),
|
||||
'dataset': ODMLoadDatasetCell(force_focal=p.args['force_focal'],
|
||||
force_ccd=p.args['force_ccd']),
|
||||
'resize': ODMResizeCell(resize_to=p.args['resize_to']),
|
||||
'dataset': ODMLoadDatasetCell(force_focal=p.args.force_focal,
|
||||
force_ccd=p.args.force_ccd),
|
||||
'resize': ODMResizeCell(resize_to=p.args.resize_to),
|
||||
'opensfm': ODMOpenSfMCell(use_exif_size=False,
|
||||
feature_process_size=p.args['resize_to'],
|
||||
feature_min_frames=p.args['min_num_features'],
|
||||
feature_process_size=p.args.resize_to,
|
||||
feature_min_frames=p.args.min_num_features,
|
||||
processes=context.num_cores,
|
||||
matching_gps_neighbors=p.args['matcher_neighbors'],
|
||||
matching_gps_distance=p.args['matcher_distance']),
|
||||
'cmvs': ODMCmvsCell(max_images=p.args['cmvs_maxImages']),
|
||||
'pmvs': ODMPmvsCell(level=p.args['pmvs_level'],
|
||||
csize=p.args['pmvs_csize'],
|
||||
thresh=p.args['pmvs_threshold'],
|
||||
wsize=p.args['pmvs_wsize'],
|
||||
min_imgs=p.args['pmvs_minImageNum'],
|
||||
cores=p.args['pmvs_num_cores']),
|
||||
'meshing': ODMeshingCell(max_vertex=p.args['odm_meshing_maxVertexCount'],
|
||||
oct_tree=p.args['odm_meshing_octreeDepth'],
|
||||
samples=p.args['odm_meshing_samplesPerNode'],
|
||||
solver=p.args['odm_meshing_solverDivide']),
|
||||
'texturing': ODMMvsTexCell(data_term=p.args['mvs_texturing_dataTerm'],
|
||||
outlier_rem_type=p.args['mvs_texturing_outlierRemovalType'],
|
||||
skip_vis_test=p.args['mvs_texturing_skipGeometricVisibilityTest'],
|
||||
skip_glob_seam_leveling=p.args['mvs_texturing_skipGlobalSeamLeveling'],
|
||||
skip_loc_seam_leveling=p.args['mvs_texturing_skipLocalSeamLeveling'],
|
||||
skip_hole_fill=p.args['mvs_texturing_skipHoleFilling'],
|
||||
keep_unseen_faces=p.args['mvs_texturing_keepUnseenFaces']),
|
||||
'texturing': ODMMvsTexCell(data_term=p.args.mvs_texturing_dataTerm,
|
||||
outlier_rem_type=p.args.mvs_texturing_outlierRemovalType,
|
||||
skip_vis_test=p.args.mvs_texturing_skipGeometricVisibilityTest,
|
||||
skip_glob_seam_leveling=p.args.mvs_texturing_skipGlobalSeamLeveling,
|
||||
skip_loc_seam_leveling=p.args.mvs_texturing_skipLocalSeamLeveling,
|
||||
skip_hole_fill=p.args.mvs_texturing_skipHoleFilling,
|
||||
keep_unseen_faces=p.args.mvs_texturing_keepUnseenFaces),
|
||||
# Old odm_texturing
|
||||
# 'texturing': ODMTexturingCell(resize=p.args['resize_to'],
|
||||
# resolution=p.args['odm_texturing_textureResolution'],
|
||||
# size=p.args['odm_texturing_textureWithSize']),
|
||||
'georeferencing': ODMGeoreferencingCell(img_size=p.args['resize_to'],
|
||||
gcp_file=p.args['odm_georeferencing_gcpFile'],
|
||||
use_gcp=p.args['odm_georeferencing_useGcp']),
|
||||
'orthophoto': ODMOrthoPhotoCell(resolution=p.args['odm_orthophoto_resolution'])
|
||||
matching_gps_neighbors=p.args.matcher_neighbors,
|
||||
matching_gps_distance=p.args.matcher_distance),
|
||||
'cmvs': ODMCmvsCell(max_images=p.args.cmvs_maxImages),
|
||||
'pmvs': ODMPmvsCell(level=p.args.pmvs_level,
|
||||
csize=p.args.pmvs_csize,
|
||||
thresh=p.args.pmvs_threshold,
|
||||
wsize=p.args.pmvs_wsize,
|
||||
min_imgs=p.args.pmvs_minImageNum,
|
||||
cores=p.args.pmvs_num_cores),
|
||||
'meshing': ODMeshingCell(max_vertex=p.args.odm_meshing_maxVertexCount,
|
||||
oct_tree=p.args.odm_meshing_octreeDepth,
|
||||
samples=p.args.odm_meshing_samplesPerNode,
|
||||
solver=p.args.odm_meshing_solverDivide),
|
||||
'texturing': ODMTexturingCell(resize=p.args.resize_to,
|
||||
resolution=p.args.odm_texturing_textureResolution,
|
||||
size=p.args.odm_texturing_textureWithSize),
|
||||
'georeferencing': ODMGeoreferencingCell(img_size=p.args.resize_to,
|
||||
gcp_file=p.args.odm_georeferencing_gcpFile,
|
||||
use_gcp=p.args.odm_georeferencing_useGcp),
|
||||
'orthophoto': ODMOrthoPhotoCell(resolution=p.args.odm_orthophoto_resolution)
|
||||
|
||||
}
|
||||
|
||||
return cells
|
||||
|
||||
def configure(self, p, _i, _o):
|
||||
tree = types.ODM_Tree(p.args['project_path'])
|
||||
tree = types.ODM_Tree(p.args.project_path)
|
||||
self.tree = ecto.Constant(value=tree)
|
||||
|
||||
# TODO(dakota) put this somewhere better maybe
|
||||
if config.args.get('time') and io.file_exists(tree.benchmarking):
|
||||
if p.args.time and io.file_exists(tree.benchmarking):
|
||||
# Delete the previously made file
|
||||
os.remove(tree.benchmarking)
|
||||
with open(tree.benchmarking, 'a') as b:
|
||||
|
|
|
@ -28,7 +28,7 @@ class ODMGeoreferencingCell(ecto.Cell):
|
|||
# Benchmarking
|
||||
start_time = system.now_raw()
|
||||
|
||||
log.ODM_INFO('Running OMD Georeferencing Cell')
|
||||
log.ODM_INFO('Running ODM Georeferencing Cell')
|
||||
|
||||
# get inputs
|
||||
args = self.inputs.args
|
||||
|
@ -68,11 +68,11 @@ class ODMGeoreferencingCell(ecto.Cell):
|
|||
return ecto.QUIT
|
||||
|
||||
# check if we rerun cell or not
|
||||
rerun_cell = (args['rerun'] is not None and
|
||||
args['rerun'] == 'odm_georeferencing') or \
|
||||
(args['rerun_all']) or \
|
||||
(args['rerun_from'] is not None and
|
||||
'odm_georeferencing' in args['rerun_from'])
|
||||
rerun_cell = (args.rerun is not None and
|
||||
args.rerun == 'odm_georeferencing') or \
|
||||
(args.rerun_all) or \
|
||||
(args.rerun_from is not None and
|
||||
'odm_georeferencing' in args.rerun_from)
|
||||
|
||||
if not io.file_exists(tree.odm_georeferencing_model_obj_geo) or \
|
||||
not io.file_exists(tree.odm_georeferencing_model_ply_geo) or rerun_cell:
|
||||
|
@ -141,8 +141,8 @@ class ODMGeoreferencingCell(ecto.Cell):
|
|||
log.ODM_WARNING('Found a valid georeferenced model in: %s'
|
||||
% tree.odm_georeferencing_model_ply_geo)
|
||||
|
||||
if args['time']:
|
||||
if args.time:
|
||||
system.benchmark(start_time, tree.benchmarking, 'Georeferencing')
|
||||
|
||||
log.ODM_INFO('Running OMD Georeferencing Cell - Finished')
|
||||
return ecto.OK if args['end_with'] != 'odm_georeferencing' else ecto.QUIT
|
||||
log.ODM_INFO('Running ODM Georeferencing Cell - Finished')
|
||||
return ecto.OK if args.end_with != 'odm_georeferencing' else ecto.QUIT
|
||||
|
|
|
@ -31,7 +31,7 @@ class ODMeshingCell(ecto.Cell):
|
|||
# Benchmarking
|
||||
start_time = system.now_raw()
|
||||
|
||||
log.ODM_INFO('Running OMD Meshing Cell')
|
||||
log.ODM_INFO('Running ODM Meshing Cell')
|
||||
|
||||
# get inputs
|
||||
args = self.inputs.args
|
||||
|
@ -41,11 +41,11 @@ class ODMeshingCell(ecto.Cell):
|
|||
system.mkdir_p(tree.odm_meshing)
|
||||
|
||||
# check if we rerun cell or not
|
||||
rerun_cell = (args['rerun'] is not None and
|
||||
args['rerun'] == 'odm_meshing') or \
|
||||
(args['rerun_all']) or \
|
||||
(args['rerun_from'] is not None and
|
||||
'odm_meshing' in args['rerun_from'])
|
||||
rerun_cell = (args.rerun is not None and
|
||||
args.rerun == 'odm_meshing') or \
|
||||
(args.rerun_all) or \
|
||||
(args.rerun_from is not None and
|
||||
'odm_meshing' in args.rerun_from)
|
||||
|
||||
if not io.file_exists(tree.odm_mesh) or rerun_cell:
|
||||
log.ODM_DEBUG('Writting ODM Mesh file in: %s' % tree.odm_mesh)
|
||||
|
@ -70,8 +70,8 @@ class ODMeshingCell(ecto.Cell):
|
|||
log.ODM_WARNING('Found a valid ODM Mesh file in: %s' %
|
||||
tree.odm_mesh)
|
||||
|
||||
if args['time']:
|
||||
if args.time:
|
||||
system.benchmark(start_time, tree.benchmarking, 'Meshing')
|
||||
|
||||
log.ODM_INFO('Running OMD Meshing Cell - Finished')
|
||||
return ecto.OK if args['end_with'] != 'odm_meshing' else ecto.QUIT
|
||||
log.ODM_INFO('Running ODM Meshing Cell - Finished')
|
||||
return ecto.OK if args.end_with != 'odm_meshing' else ecto.QUIT
|
||||
|
|
|
@ -31,11 +31,11 @@ class ODMOrthoPhotoCell(ecto.Cell):
|
|||
system.mkdir_p(tree.odm_orthophoto)
|
||||
|
||||
# check if we rerun cell or not
|
||||
rerun_cell = (args['rerun'] is not None and
|
||||
args['rerun'] == 'odm_orthophoto') or \
|
||||
(args['rerun_all']) or \
|
||||
(args['rerun_from'] is not None and
|
||||
'odm_orthophoto' in args['rerun_from'])
|
||||
rerun_cell = (args.rerun is not None and
|
||||
args.rerun == 'odm_orthophoto') or \
|
||||
(args.rerun_all) or \
|
||||
(args.rerun_from is not None and
|
||||
'odm_orthophoto' in args.rerun_from)
|
||||
|
||||
if not io.file_exists(tree.odm_orthophoto_file) or rerun_cell:
|
||||
|
||||
|
@ -98,8 +98,8 @@ class ODMOrthoPhotoCell(ecto.Cell):
|
|||
else:
|
||||
log.ODM_WARNING('Found a valid orthophoto in: %s' % tree.odm_orthophoto_file)
|
||||
|
||||
if args['time']:
|
||||
if args.time:
|
||||
system.benchmark(start_time, tree.benchmarking, 'Orthophoto')
|
||||
|
||||
log.ODM_INFO('Running OMD OrthoPhoto Cell - Finished')
|
||||
return ecto.OK if args['end_with'] != 'odm_orthophoto' else ecto.QUIT
|
||||
log.ODM_INFO('Running ODM OrthoPhoto Cell - Finished')
|
||||
return ecto.OK if args.end_with != 'odm_orthophoto' else ecto.QUIT
|
||||
|
|
|
@ -25,7 +25,7 @@ class ODMTexturingCell(ecto.Cell):
|
|||
# Benchmarking
|
||||
start_time = system.now_raw()
|
||||
|
||||
log.ODM_INFO('Running OMD Texturing Cell')
|
||||
log.ODM_INFO('Running ODM Texturing Cell')
|
||||
|
||||
# get inputs
|
||||
args = self.inputs.args
|
||||
|
@ -35,11 +35,11 @@ class ODMTexturingCell(ecto.Cell):
|
|||
system.mkdir_p(tree.odm_texturing)
|
||||
|
||||
# check if we rerun cell or not
|
||||
rerun_cell = (args['rerun'] is not None and
|
||||
args['rerun'] == 'odm_texturing') or \
|
||||
(args['rerun_all']) or \
|
||||
(args['rerun_from'] is not None and
|
||||
'odm_texturing' in args['rerun_from'])
|
||||
rerun_cell = (args.rerun is not None and
|
||||
args.rerun == 'odm_texturing') or \
|
||||
(args.rerun_all) or \
|
||||
(args.rerun_from is not None and
|
||||
'odm_texturing' in args.rerun_from)
|
||||
|
||||
if not io.file_exists(tree.odm_textured_model_obj) or rerun_cell:
|
||||
log.ODM_DEBUG('Writing ODM Textured file in: %s'
|
||||
|
@ -69,8 +69,8 @@ class ODMTexturingCell(ecto.Cell):
|
|||
log.ODM_WARNING('Found a valid ODM Texture file in: %s'
|
||||
% tree.odm_textured_model_obj)
|
||||
|
||||
if args['time']:
|
||||
if args.time:
|
||||
system.benchmark(start_time, tree.benchmarking, 'Texturing')
|
||||
|
||||
log.ODM_INFO('Running OMD Texturing Cell - Finished')
|
||||
return ecto.OK if args['end_with'] != 'odm_texturing' else ecto.QUIT
|
||||
log.ODM_INFO('Running ODM Texturing Cell - Finished')
|
||||
return ecto.OK if args.end_with != 'odm_texturing' else ecto.QUIT
|
||||
|
|
|
@ -26,7 +26,7 @@ class ODMOpenSfMCell(ecto.Cell):
|
|||
# Benchmarking
|
||||
start_time = system.now_raw()
|
||||
|
||||
log.ODM_INFO('Running OMD OpenSfm Cell')
|
||||
log.ODM_INFO('Running ODM OpenSfM Cell')
|
||||
|
||||
# get inputs
|
||||
tree = self.inputs.tree
|
||||
|
@ -34,7 +34,7 @@ class ODMOpenSfMCell(ecto.Cell):
|
|||
photos = self.inputs.photos
|
||||
|
||||
if not photos:
|
||||
log.ODM_ERROR('Not enough photos in photos array to start OpenSfm')
|
||||
log.ODM_ERROR('Not enough photos in photos array to start OpenSfM')
|
||||
return ecto.QUIT
|
||||
|
||||
# create working directories
|
||||
|
@ -42,11 +42,11 @@ class ODMOpenSfMCell(ecto.Cell):
|
|||
system.mkdir_p(tree.pmvs)
|
||||
|
||||
# check if we rerun cell or not
|
||||
rerun_cell = (args['rerun'] is not None and
|
||||
args['rerun'] == 'opensfm') or \
|
||||
(args['rerun_all']) or \
|
||||
(args['rerun_from'] is not None and
|
||||
'opensfm' in args['rerun_from'])
|
||||
rerun_cell = (args.rerun is not None and
|
||||
args.rerun == 'opensfm') or \
|
||||
(args.rerun_all) or \
|
||||
(args.rerun_from is not None and
|
||||
'opensfm' in args.rerun_from)
|
||||
|
||||
# check if reconstruction was done before
|
||||
|
||||
|
@ -78,7 +78,7 @@ class ODMOpenSfMCell(ecto.Cell):
|
|||
system.run('PYTHONPATH=%s %s/bin/run_all %s' %
|
||||
(context.pyopencv_path, context.opensfm_path, tree.opensfm))
|
||||
else:
|
||||
log.ODM_WARNING('Found a valid OpenSfm file in: %s' %
|
||||
log.ODM_WARNING('Found a valid OpenSfM file in: %s' %
|
||||
tree.opensfm_reconstruction)
|
||||
|
||||
# check if reconstruction was exported to bundler before
|
||||
|
@ -100,8 +100,8 @@ class ODMOpenSfMCell(ecto.Cell):
|
|||
else:
|
||||
log.ODM_WARNING('Found a valid CMVS file in: %s' % tree.pmvs_visdat)
|
||||
|
||||
if args['time']:
|
||||
if args.time:
|
||||
system.benchmark(start_time, tree.benchmarking, 'OpenSfM')
|
||||
|
||||
log.ODM_INFO('Running OMD OpenSfm Cell - Finished')
|
||||
return ecto.OK if args['end_with'] != 'opensfm' else ecto.QUIT
|
||||
log.ODM_INFO('Running ODM OpenSfM Cell - Finished')
|
||||
return ecto.OK if args.end_with != 'opensfm' else ecto.QUIT
|
||||
|
|
|
@ -44,11 +44,11 @@ class ODMPmvsCell(ecto.Cell):
|
|||
tree = self.inputs.tree
|
||||
|
||||
# check if we rerun cell or not
|
||||
rerun_cell = (args['rerun'] is not None and
|
||||
args['rerun'] == 'pmvs') or \
|
||||
(args['rerun_all']) or \
|
||||
(args['rerun_from'] is not None and
|
||||
'pmvs' in args['rerun_from'])
|
||||
rerun_cell = (args.rerun is not None and
|
||||
args.rerun == 'pmvs') or \
|
||||
(args.rerun_all) or \
|
||||
(args.rerun_from is not None and
|
||||
'pmvs' in args.rerun_from)
|
||||
|
||||
if not io.file_exists(tree.pmvs_model) or rerun_cell:
|
||||
log.ODM_DEBUG('Creating dense pointcloud in: %s' % tree.pmvs_model)
|
||||
|
@ -75,8 +75,8 @@ class ODMPmvsCell(ecto.Cell):
|
|||
else:
|
||||
log.ODM_WARNING('Found a valid PMVS file in %s' % tree.pmvs_model)
|
||||
|
||||
if args['time']:
|
||||
if args.time:
|
||||
system.benchmark(start_time, tree.benchmarking, 'PMVS')
|
||||
|
||||
log.ODM_INFO('Running OMD PMVS Cell - Finished')
|
||||
return ecto.OK if args['end_with'] != 'pmvs' else ecto.QUIT
|
||||
log.ODM_INFO('Running ODM PMVS Cell - Finished')
|
||||
return ecto.OK if args.end_with != 'pmvs' else ecto.QUIT
|
||||
|
|
|
@ -34,17 +34,21 @@ class ODMResizeCell(ecto.Cell):
|
|||
log.ODM_ERROR('Not enough photos in photos to resize')
|
||||
return ecto.QUIT
|
||||
|
||||
if self.params.resize_to <= 0:
|
||||
log.ODM_ERROR('Resize parameter must be greater than 0')
|
||||
return ecto.QUIT
|
||||
|
||||
# create working directory
|
||||
system.mkdir_p(tree.dataset_resize)
|
||||
|
||||
log.ODM_DEBUG('Resizing dataset to: %s' % tree.dataset_resize)
|
||||
|
||||
# check if we rerun cell or not
|
||||
rerun_cell = (args['rerun'] is not None and
|
||||
args['rerun'] == 'resize') or \
|
||||
(args['rerun_all']) or \
|
||||
(args['rerun_from'] is not None and
|
||||
'resize' in args['rerun_from'])
|
||||
rerun_cell = (args.rerun is not None and
|
||||
args.rerun == 'resize') or \
|
||||
(args.rerun_all) or \
|
||||
(args.rerun_from is not None and
|
||||
'resize' in args.rerun_from)
|
||||
|
||||
# loop over photos
|
||||
for photo in photos:
|
||||
|
@ -60,6 +64,8 @@ class ODMResizeCell(ecto.Cell):
|
|||
img = cv2.imread(path_file)
|
||||
# compute new size
|
||||
max_side = max(img.shape[0], img.shape[1])
|
||||
if max_side <= self.params.resize_to:
|
||||
log.ODM_WARNING('Resize Parameter is greater than the largest side of the image')
|
||||
ratio = float(self.params.resize_to) / float(max_side)
|
||||
img_r = cv2.resize(img, None, fx=ratio, fy=ratio)
|
||||
# write image with opencv
|
||||
|
@ -94,8 +100,8 @@ class ODMResizeCell(ecto.Cell):
|
|||
# append photos to cell output
|
||||
self.outputs.photos = photos
|
||||
|
||||
if args['time']:
|
||||
if args.time:
|
||||
system.benchmark(start_time, tree.benchmarking, 'Resizing')
|
||||
|
||||
log.ODM_INFO('Running ODM Resize Cell - Finished')
|
||||
return ecto.OK if args['end_with'] != 'resize' else ecto.QUIT
|
||||
return ecto.OK if args.end_with != 'resize' else ecto.QUIT
|
||||
|
|
Ładowanie…
Reference in New Issue