summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Klug <stefan.klug@ideasonboard.com>2024-12-17 15:59:35 +0100
committerStefan Klug <stefan.klug@ideasonboard.com>2024-12-18 17:20:32 +0100
commit24e00be9f3ded4dc68f7c3b1ddc6166e987881fd (patch)
tree8e02003a453c7967740265e6c2aba26598ab5571
parent936a099ecab1f93b9fd77171bd904e0ad30e4f9f (diff)
utils: tuning: libtuning: Fix tuning for non RGGB RAWs
Tuning fails for raw images that don't have the channels ordered in RGGB. In 19dc8c28f63c ("utils: tuning: libtuning: Implement the core of libtuning") the channels of the image were reordered to RGGB unconditionally in _read_image_dng(). That change was not applied to the ctt_awb code, so that the channels were reordered twice. Fix by removing the double ordering. Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Tested-by: Isaac Scott <isaac.scott@ideasonboard.com> Reviewed-by: Isaac Scott <isaac.scott@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--utils/tuning/libtuning/ctt_awb.py3
-rw-r--r--utils/tuning/libtuning/image.py2
2 files changed, 2 insertions, 3 deletions
diff --git a/utils/tuning/libtuning/ctt_awb.py b/utils/tuning/libtuning/ctt_awb.py
index abf22321..63bb9000 100644
--- a/utils/tuning/libtuning/ctt_awb.py
+++ b/utils/tuning/libtuning/ctt_awb.py
@@ -301,10 +301,10 @@ def get_alsc_patches(Img, colour_cals, grey=True):
patches for each channel, remembering to subtract blacklevel
If grey then only greyscale patches considered
"""
+ patches = Img.patches
if grey:
cen_coords = Img.cen_coords[3::4]
col = Img.col
- patches = [np.array(Img.patches[i]) for i in Img.order]
r_patchs = patches[0][3::4] - Img.blacklevel_16
b_patchs = patches[3][3::4] - Img.blacklevel_16
"""
@@ -314,7 +314,6 @@ def get_alsc_patches(Img, colour_cals, grey=True):
else:
cen_coords = Img.cen_coords
col = Img.color
- patches = [np.array(Img.patches[i]) for i in Img.order]
r_patchs = patches[0] - Img.blacklevel_16
b_patchs = patches[3] - Img.blacklevel_16
g_patchs = (patches[1]+patches[2])/2 - Img.blacklevel_16
diff --git a/utils/tuning/libtuning/image.py b/utils/tuning/libtuning/image.py
index c8911a0f..ecd334bd 100644
--- a/utils/tuning/libtuning/image.py
+++ b/utils/tuning/libtuning/image.py
@@ -135,6 +135,6 @@ class Image:
all_patches.append(ch_patches)
- self.patches = all_patches
+ self.patches = np.array(all_patches)
return not saturated