From 892107a959ec45b2cf3a44a12cca4d57c77e6bd1 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Fri, 27 Mar 2020 10:05:42 -0400 Subject: [PATCH] Fixed radiometric-calibration bug Former-commit-id: 544baba9e4697e99336007e5671ba6fe232d542a --- opendm/multispectral.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/opendm/multispectral.py b/opendm/multispectral.py index 89906940..95b001ee 100644 --- a/opendm/multispectral.py +++ b/opendm/multispectral.py @@ -14,6 +14,8 @@ def dn_to_radiance(photo, image): """ image = image.astype("float32") + if len(image.shape) != 3: + raise ValueError("Image should have shape length of 3 (got: %s)" % len(image.shape)) # Handle thermal bands (experimental) if photo.band_name == 'LWIR': @@ -50,11 +52,13 @@ def dn_to_radiance(photo, image): if V is not None: # vignette correction + V = np.repeat(V[:, :, np.newaxis], image.shape[2], axis=2) image *= V if exposure_time and a2 is not None and a3 is not None: # row gradient correction R = 1.0 / (1.0 + a2 * y / exposure_time - a3 * y) + R = np.repeat(R[:, :, np.newaxis], image.shape[2], axis=2) image *= R # Floor any negative radiances to zero (can happend due to noise around blackLevel)