diff --git a/opendm/config.py b/opendm/config.py index 42e989c0..ec22ea69 100644 --- a/opendm/config.py +++ b/opendm/config.py @@ -50,56 +50,49 @@ parser.add_argument('--min-num-features', type=int, help=('Minimum number of features to extract per image. ' 'More features leads to better results but slower ' - 'execution.')) + 'execution. Default: %(default)s')) parser.add_argument('--matcher-threshold', metavar='', default=2.0, type=float, help=('Ignore matched keypoints if the two images share ' - 'less than percent of keypoints')) + 'less than percent of keypoints. Default:' + ' $(default)s')) parser.add_argument('--matcher-ratio', metavar='', default=0.6, type=float, help=('Ratio of the distance to the next best matched ' - 'keypoint')) + 'keypoint. Default: %(default)s')) -parser.add_argument('--matcher-preselect', - type=bool, - metavar='', - default=False, - help=('use GPS exif data, if available, to match each ' - 'image only with its k-nearest neighbors, or all ' - 'images within a certain distance threshold')) - -parser.add_argument('--matcher-useKnn', - type=bool, - metavar='', - default=True, - help=('use GPS exif data, if available, to match each ' - 'image only with its k-nearest neighbors, or all ' - 'images within a certain distance threshold')) - -parser.add_argument('--matcher-kDistance', - metavar='', - default=20, +parser.add_argument('--matcher-neighbors', type=int, - help='') - -parser.add_argument('--matcher-k', metavar='', 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-distance', + metavar='', + default=0, type=int, - help='Number of k-nearest images to match ' - 'when using OpenSfM') + 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('--cmvs-maxImages', metavar='', default=500, type=int, - help='The maximum number of images per cluster') + help='The maximum number of images per cluster. ' + 'Default: %(default)s') parser.add_argument('--pmvs-level', metavar='', @@ -108,32 +101,33 @@ parser.add_argument('--pmvs-level', 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')) + 'more pmvs documentation. Default: %(default)s')) parser.add_argument('--pmvs-csize', metavar='< positive integer>', default=2, type=int, - help='Cell size controls the density of reconstructions') + help='Cell size controls the density of reconstructions' + 'Default: %(default)s') parser.add_argument('--pmvs-threshold', metavar='', default=0.7, type=float, help=('A patch reconstruction is accepted as a success ' - 'and kept, if its associcated photometric consistency ' - 'measure is above this threshold.')) + 'and kept if its associated photometric consistency ' + 'measure is above this threshold. Default: %(default)s')) parser.add_argument('--pmvs-wsize', metavar='', default=7, type=int, - help=('pmvs samples wsize x wsize pixel colors from ' + 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.')) + 'the program becomes slower. Default: %(default)s') parser.add_argument('--pmvs-minImageNum', metavar='', @@ -141,20 +135,21 @@ parser.add_argument('--pmvs-minImageNum', type=int, help=('Each 3D point must be visible in at least ' 'minImageNum images for being reconstructed. 3 is ' - 'suggested in general.')) + 'suggested in general. Default: %(default)s')) parser.add_argument('--pmvs-num-cores', metavar='', default=1, type=int, help=('The maximum number of cores to use in dense ' - 'reconstruction.')) + 'reconstruction. Default: %(default)s')) parser.add_argument('--odm_meshing-maxVertexCount', metavar='', default=100000, type=int, - help='The maximum vertex count of the output mesh') + help=('The maximum vertex count of the output mesh ' + 'Default: %(default)s')) parser.add_argument('--odm_meshing-octreeDepth', metavar='', @@ -162,14 +157,14 @@ parser.add_argument('--odm_meshing-octreeDepth', type=int, help=('Oct-tree depth used in the mesh reconstruction, ' 'increase to get more vertices, recommended ' - 'values are 8-12')) + 'values are 8-12. Default: %(default)s')) parser.add_argument('--odm_meshing-samplesPerNode', metavar='= 1.0>', - default=1, + default=1.0, type=float, help=('Number of points per octree node, recommended ' - 'value: 1.0')) + 'and default value: %(default)s')) parser.add_argument('--odm_meshing-solverDivide', metavar='', @@ -178,44 +173,48 @@ parser.add_argument('--odm_meshing-solverDivide', 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.')) + 'times slightly but helps reduce memory usage. ' + 'Default: %(default)s')) parser.add_argument('--odm_texturing-textureResolution', metavar='', default=4096, type=int, help=('The resolution of the output textures. Must be ' - 'greater than textureWithSize.')) + 'greater than textureWithSize. Default: %(default)s')) parser.add_argument('--odm_texturing-textureWithSize', metavar='', default=3600, type=int, help=('The resolution to rescale the images performing ' - 'the texturing.')) + 'the texturing. Default: %(default)s')) parser.add_argument('--odm_georeferencing-gcpFile', metavar='', default='gcp_list.txt', help=('path to the file containing the ground control ' - 'points used for georeferencing.The file needs to ' + 'points used for georeferencing. Default: ' + '%(default)s. The file needs to ' 'be on the following line format: \neasting ' 'northing height pixelrow pixelcol imagename')) parser.add_argument('--odm_georeferencing-useGcp', - type = bool, + action = 'store_true', default = False, - help = 'set to true for enabling GCPs from the file above') + help = 'Enabling GCPs from the file above. The GCP file ' + 'is not used by default.') parser.add_argument('--odm_orthophoto-resolution', metavar=' 0.0>', default=20.0, type=float, - help=('Orthophoto ground resolution in pixels/meter')) + 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') -args = vars(parser.parse_args()) \ No newline at end of file +args = vars(parser.parse_args()) diff --git a/scripts/odm_app.py b/scripts/odm_app.py index d972a782..19236eb6 100644 --- a/scripts/odm_app.py +++ b/scripts/odm_app.py @@ -38,7 +38,8 @@ class ODMApp(ecto.BlackBox): 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_k']), + 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'], @@ -118,4 +119,4 @@ class ODMApp(ecto.BlackBox): self.args[:] >> self.orthophoto['args'], self.georeferencing['reconstruction'] >> self.orthophoto['reconstruction'] ] - return connections \ No newline at end of file + return connections diff --git a/scripts/opensfm.py b/scripts/opensfm.py index 2e7788ef..9a9fa2f1 100644 --- a/scripts/opensfm.py +++ b/scripts/opensfm.py @@ -8,10 +8,11 @@ from opendm import context class ODMOpenSfMCell(ecto.Cell): def declare_params(self, params): params.declare("use_exif_size", "The application arguments.", False) - params.declare("feature_process_size", "The application arguments.", False) - params.declare("feature_min_frames", "The application arguments.", 0) - params.declare("processes", "The application arguments.", 0) - params.declare("matching_gps_neighbors", "The application arguments.", 0) + params.declare("feature_process_size", "The application arguments.", 2400) + params.declare("feature_min_frames", "The application arguments.", 4000) + params.declare("processes", "The application arguments.", context.num_cores) + params.declare("matching_gps_neighbors", "The application arguments.", 8) + params.declare("matching_gps_distance", "The application arguments.", 0) def declare_io(self, params, inputs, outputs): inputs.declare("tree", "Struct with paths", []) @@ -59,6 +60,9 @@ class ODMOpenSfMCell(ecto.Cell): "matching_gps_neighbors: %s" % self.params.matching_gps_neighbors ] + if args['matcher_distance']>0: + config.append("matching_gps_distance: %s" % self.params.matching_gps_distance) + # write config file config_filename = io.join_paths(tree.opensfm, 'config.yaml') with open(config_filename, 'w') as fout: @@ -93,4 +97,4 @@ class ODMOpenSfMCell(ecto.Cell): log.ODM_WARNING('Found a valid CMVS file in: %s' % tree.pmvs_visdat) log.ODM_INFO('Running OMD OpenSfm Cell - Finished') - return ecto.OK if args['end_with'] != 'opensfm' else ecto.QUIT \ No newline at end of file + return ecto.OK if args['end_with'] != 'opensfm' else ecto.QUIT