diff --git a/opendm/config.py b/opendm/config.py index c61a692c..6cf661b8 100755 --- a/opendm/config.py +++ b/opendm/config.py @@ -180,12 +180,12 @@ def config(argv=None, parser=None): 'Can be specified either as path to a cameras.json file or as a ' 'JSON string representing the contents of a ' 'cameras.json file. Default: %(default)s') - + parser.add_argument('--camera-lens', metavar='', action=StoreValue, default='auto', - choices=['auto', 'perspective', 'brown', 'fisheye', 'spherical'], + choices=['auto', 'perspective', 'brown', 'fisheye', 'spherical', 'equirectangular', 'dual'], help=('Set a camera projection type. Manually setting a value ' 'can help improve geometric undistortion. By default the application ' 'tries to determine a lens type from the images metadata. Can be one of: %(choices)s. Default: ' diff --git a/opendm/photo.py b/opendm/photo.py index 4378c390..dcd48b3d 100644 --- a/opendm/photo.py +++ b/opendm/photo.py @@ -617,6 +617,10 @@ class ODM_Photo: def override_gps_dop(self, dop): self.gps_xy_stddev = self.gps_z_stddev = dop + def override_camera_projection(self, camera_projection): + if camera_projection in projections: + self.camera_projection = camera_projection + def is_thermal(self): #Added for support M2EA camera sensor if(self.camera_make == "DJI"): diff --git a/stages/dataset.py b/stages/dataset.py index 8000c61d..9684a0d1 100644 --- a/stages/dataset.py +++ b/stages/dataset.py @@ -136,6 +136,13 @@ class ODMLoadDatasetStage(types.ODM_Stage): for p in photos: p.override_gps_dop(args.gps_accuracy) + + # Override projection type + if args.camera_lens != "auto": + log.ODM_INFO("Setting camera lens to %s for all images" % args.camera_lens) + + for p in photos: + p.override_camera_projection(args.camera_lens) # Save image database for faster restart save_images_database(photos, images_database_file)