Catch bad JSON input, added missing test file

Former-commit-id: 1c90eb3186
pull/1161/head
Piero Toffanin 2019-06-25 14:22:12 -04:00
rodzic b81f829afc
commit 34dd2b1a6b
3 zmienionych plików z 7 dodań i 2 usunięć

Wyświetl plik

@ -159,7 +159,7 @@ def config():
parser.add_argument('--cameras',
default='',
metavar='<string>',
metavar='<json>',
type=path_or_json_string,
help='Use the camera parameters computed from '
'another dataset instead of calculating them. '

Wyświetl plik

@ -89,8 +89,9 @@ class OSFMContext:
# check for cameras
if args.cameras:
try:
camera_overrides = camera.get_opensfm_camera_models(args.cameras)
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)))
f.write(json.dumps(camera_overrides))
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))

Wyświetl plik

@ -0,0 +1,4 @@
WGS84 UTM 16N
609924.8180680283 4950688.771811823 171.662982 1331 350 DJI_0002.JPG gcp1
609924.8180680283 4950688.771811823 171.662982 2028 87 DJI_0003.JPG gcp1
609924.8180680283 4950688.771811823 171.662982 2101 1181 DJI_0004.JPG gcp1