diff --git a/modules/odm_georef/src/Georef.cpp b/modules/odm_georef/src/Georef.cpp index 14273665..d56ec2ae 100644 --- a/modules/odm_georef/src/Georef.cpp +++ b/modules/odm_georef/src/Georef.cpp @@ -1197,7 +1197,7 @@ void Georef::chooseBestCameraTriplet(size_t &cam0, size_t &cam1, size_t &cam2) trans.findTransform(cameras_[t].getPos(), cameras_[s].getPos(), cameras_[p].getPos(), cameras_[t].getReferencedPos(), cameras_[s].getReferencedPos(), cameras_[p].getReferencedPos()); - // The total error for the curren camera triplet. + // The total error for the current camera triplet. double totError = 0.0; for(size_t r = 0; r < cameras_.size(); ++r) diff --git a/opendm/config.py b/opendm/config.py index e8d84589..fd29f6cc 100644 --- a/opendm/config.py +++ b/opendm/config.py @@ -288,6 +288,12 @@ def config(): default=False, help='compress the results using gunzip') + parser.add_argument('--verbose', '-v', + action='store_true', + default=False, + help='Print additional messages to the console\n' + 'Default: %(default)s') + parser.add_argument('--time', action='store_true', default=False, diff --git a/scripts/odm_app.py b/scripts/odm_app.py index f5abef41..6d6b4dbe 100644 --- a/scripts/odm_app.py +++ b/scripts/odm_app.py @@ -57,7 +57,8 @@ class ODMApp(ecto.BlackBox): '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), + solver=p.args.odm_meshing_solverDivide, + verbose=p.args.verbose), '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, @@ -70,8 +71,10 @@ class ODMApp(ecto.BlackBox): # resolution=p.args['odm_texturing_textureResolution'], '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) + use_gcp=p.args.odm_georeferencing_useGcp, + verbose=p.args.verbose), + 'orthophoto': ODMOrthoPhotoCell(resolution=p.args.odm_orthophoto_resolution, + verbose=p.args.verbose) } diff --git a/scripts/odm_georeferencing.py b/scripts/odm_georeferencing.py index dea64e6f..affcdd99 100644 --- a/scripts/odm_georeferencing.py +++ b/scripts/odm_georeferencing.py @@ -16,6 +16,7 @@ class ODMGeoreferencingCell(ecto.Cell): 'northing height pixelrow pixelcol imagename', 'gcp_list.txt') params.declare("use_gcp", 'set to true for enabling GCPs from the file above', False) params.declare("img_size", 'image size used in calibration', 2400) + params.declare("verbose", 'print additional messages to console', False) def declare_io(self, params, inputs, outputs): inputs.declare("tree", "Struct with paths", []) @@ -34,6 +35,7 @@ class ODMGeoreferencingCell(ecto.Cell): args = self.inputs.args tree = self.inputs.tree gcpfile = io.join_paths(tree.root_path, self.params.gcp_file) + verbose = '-verbose' if self.params.verbose else '' # define paths and create working directories system.mkdir_p(tree.odm_georeferencing) @@ -53,12 +55,13 @@ class ODMGeoreferencingCell(ecto.Cell): 'imgs': tree.dataset_resize, 'imgs_list': tree.opensfm_bundle_list, 'coords': tree.odm_georeferencing_coords, - 'log': tree.odm_georeferencing_utm_log + 'log': tree.odm_georeferencing_utm_log, + 'verbose': verbose } # run UTM extraction binary system.run('{bin}/odm_extract_utm -imagesPath {imgs}/ ' - '-imageListFile {imgs_list} -outputCoordFile {coords} ' + '-imageListFile {imgs_list} -outputCoordFile {coords} {verbose} ' '-logFile {log}'.format(**kwargs)) except Exception, e: @@ -92,6 +95,7 @@ class ODMGeoreferencingCell(ecto.Cell): 'model_geo': tree.odm_georeferencing_model_obj_geo, 'size': self.params.img_size, 'gcp': gcpfile, + 'verbose': verbose } if args.use_opensfm_pointcloud: @@ -104,13 +108,13 @@ class ODMGeoreferencingCell(ecto.Cell): system.run('{bin}/odm_georef -bundleFile {bundle} -imagesPath {imgs} -imagesListPath {imgs_list} ' '-bundleResizedTo {size} -inputFile {model} -outputFile {model_geo} ' - '-inputPointCloudFile {pc} -outputPointCloudFile {pc_geo} ' + '-inputPointCloudFile {pc} -outputPointCloudFile {pc_geo} {verbose} ' '-logFile {log} -georefFileOutputPath {geo_sys} -gcpFile {gcp} ' '-outputCoordFile {coords}'.format(**kwargs)) else: system.run('{bin}/odm_georef -bundleFile {bundle} -inputCoordFile {coords} ' '-inputFile {model} -outputFile {model_geo} ' - '-inputPointCloudFile {pc} -outputPointCloudFile {pc_geo} ' + '-inputPointCloudFile {pc} -outputPointCloudFile {pc_geo} {verbose} ' '-logFile {log} -georefFileOutputPath {geo_sys}'.format(**kwargs)) # update images metadata diff --git a/scripts/odm_meshing.py b/scripts/odm_meshing.py index 1db4dab8..0d26a8b7 100644 --- a/scripts/odm_meshing.py +++ b/scripts/odm_meshing.py @@ -19,6 +19,7 @@ class ODMeshingCell(ecto.Cell): 'is solved in the surface reconstruction step. ' 'Increasing this value increases computation ' 'times slightly but helps reduce memory usage.', 9) + params.declare("verbose", 'print additional messages to console', False) def declare_io(self, params, inputs, outputs): inputs.declare("tree", "Struct with paths", []) @@ -36,6 +37,7 @@ class ODMeshingCell(ecto.Cell): # get inputs args = self.inputs.args tree = self.inputs.tree + verbose = '-verbose' if self.params.verbose else '' # define paths and create working directories system.mkdir_p(tree.odm_meshing) @@ -57,7 +59,8 @@ class ODMeshingCell(ecto.Cell): 'max_vertex': self.params.max_vertex, 'oct_tree': self.params.oct_tree, 'samples': self.params.samples, - 'solver': self.params.solver + 'solver': self.params.solver, + 'verbose': verbose } if args.use_opensfm_pointcloud: kwargs['infile'] = tree.opensfm_model @@ -67,7 +70,7 @@ class ODMeshingCell(ecto.Cell): # run meshing binary system.run('{bin}/odm_meshing -inputFile {infile} ' '-outputFile {outfile} -logFile {log} ' - '-maxVertexCount {max_vertex} -octreeDepth {oct_tree} ' + '-maxVertexCount {max_vertex} -octreeDepth {oct_tree} {verbose} ' '-samplesPerNode {samples} -solverDivide {solver}'.format(**kwargs)) else: log.ODM_WARNING('Found a valid ODM Mesh file in: %s' % diff --git a/scripts/odm_orthophoto.py b/scripts/odm_orthophoto.py index 34df9d20..b7274f2e 100644 --- a/scripts/odm_orthophoto.py +++ b/scripts/odm_orthophoto.py @@ -10,6 +10,7 @@ from opendm import types class ODMOrthoPhotoCell(ecto.Cell): def declare_params(self, params): params.declare("resolution", 'Orthophoto ground resolution in pixels/meter', 20) + params.declare("verbose", 'print additional messages to console', False) def declare_io(self, params, inputs, outputs): inputs.declare("tree", "Struct with paths", []) @@ -26,6 +27,7 @@ class ODMOrthoPhotoCell(ecto.Cell): # get inputs args = self.inputs.args tree = self.inputs.tree + verbose = '-verbose' if self.params.verbose else '' # define paths and create working directories system.mkdir_p(tree.odm_orthophoto) @@ -46,12 +48,13 @@ class ODMOrthoPhotoCell(ecto.Cell): 'log': tree.odm_orthophoto_log, 'ortho': tree.odm_orthophoto_file, 'corners': tree.odm_orthophoto_corners, - 'res': self.params.resolution + 'res': self.params.resolution, + 'verbose': verbose } # run odm_orthophoto system.run('{bin}/odm_orthophoto -inputFile {model_geo} ' - '-logFile {log} -outputFile {ortho} -resolution {res} ' + '-logFile {log} -outputFile {ortho} -resolution {res} {verbose} ' '-outputCornerFile {corners}'.format(**kwargs)) # Create georeferenced GeoTiff diff --git a/scripts/odm_texturing.py b/scripts/odm_texturing.py index d397a3eb..a8ca0239 100644 --- a/scripts/odm_texturing.py +++ b/scripts/odm_texturing.py @@ -13,6 +13,7 @@ class ODMTexturingCell(ecto.Cell): 'greater than textureWithSize.', 4096) params.declare("size", 'The resolution to rescale the images performing ' 'the texturing.', 3600) + params.declare("verbose", 'print additional messages to console', False) def declare_io(self, params, inputs, outputs): inputs.declare("tree", "Struct with paths", []) @@ -30,6 +31,7 @@ class ODMTexturingCell(ecto.Cell): # get inputs args = self.inputs.args tree = self.inputs.tree + verbose = '-verbose' if self.params.verbose else '' # define paths and create working directories system.mkdir_p(tree.odm_texturing) @@ -56,14 +58,15 @@ class ODMTexturingCell(ecto.Cell): 'log': tree.odm_texuring_log, 'resize': self.params.resize, 'resolution': self.params.resolution, - 'size': self.params.size + 'size': self.params.size, + 'verbose': verbose } # run texturing binary system.run('{bin}/odm_texturing -bundleFile {bundle} ' '-imagesPath {imgs_path} -imagesListPath {imgs_list} ' '-inputModelPath {model} -outputFolder {out_dir}/ ' - '-textureResolution {resolution} -bundleResizedTo {resize} ' + '-textureResolution {resolution} -bundleResizedTo {resize} {verbose} ' '-textureWithSize {size} -logFile {log}'.format(**kwargs)) else: log.ODM_WARNING('Found a valid ODM Texture file in: %s'