From c49e460031c67994eb068ed8db845ec7084fc88d Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Tue, 25 Jun 2019 13:18:27 -0400 Subject: [PATCH] Misc fixes --- opendm/config.py | 4 +--- opendm/osfm.py | 8 ++++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/opendm/config.py b/opendm/config.py index bcd9d916..f58d4263 100644 --- a/opendm/config.py +++ b/opendm/config.py @@ -27,7 +27,7 @@ def alphanumeric_string(string): def path_or_json_string(string): if string == "": return {} - + if string.startswith("[") or string.startswith("{"): try: return json.loads(string) @@ -586,8 +586,6 @@ def config(): '%(default)s')) args = parser.parse_args() - print(args.cameras) - exit(1) # check that the project path setting has been set properly if not args.project_path: diff --git a/opendm/osfm.py b/opendm/osfm.py index 68e6caad..267a7695 100644 --- a/opendm/osfm.py +++ b/opendm/osfm.py @@ -89,9 +89,9 @@ class OSFMContext: # check for cameras if args.cameras: try: - with open(os.path.join(self.opensfm_project_path, "camera_models_overrides.json"), 'r') as f: + with open(os.path.join(self.opensfm_project_path, "camera_models_overrides.json"), 'w') as f: f.write(json.dumps(camera.get_opensfm_camera_models(args.cameras))) - log.ODM_DEBUG("Wrote camera_models_overrides.json to OpenSfM directory (camera_models_overrides.json)") + log.ODM_DEBUG("Wrote camera_models_overrides.json to OpenSfM directory") except Exception as e: log.ODM_WARNING("Cannot set camera_models_overrides.json: %s" % str(e)) @@ -107,7 +107,7 @@ class OSFMContext: "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 args.use_fixed_camera_params or has_camera_calibration else 'yes'), + "optimize_camera_parameters: %s" % ('no' if args.use_fixed_camera_params or args.cameras else 'yes'), "undistorted_image_format: png", # mvs-texturing exhibits artifacts with JPG "bundle_outlier_filtering_type: AUTO", ] @@ -196,9 +196,9 @@ class OSFMContext: return os.path.join(self.opensfm_project_path, *paths) def extract_cameras(self, output, rerun=False): - reconstruction_file = self.path("reconstruction.json") if not os.path.exists(output) or rerun: try: + reconstruction_file = self.path("reconstruction.json") with open(output, 'w') as fout: fout.write(json.dumps(camera.get_cameras_from_opensfm(reconstruction_file))) except Exception as e: