summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Klug <stefan.klug@ideasonboard.com>2024-06-11 08:59:17 +0200
committerStefan Klug <stefan.klug@ideasonboard.com>2024-07-05 22:38:16 +0200
commit22c7c1e560ded2f0bf882cc92283881bdeedc2cc (patch)
tree06058b77f447d0c51702c52762f9735eea96d4ad
parentaa02706a34474eb108cf99f94396341e2709f045 (diff)
libtuning: Fix visualize_macbeth_chart()
The old function uses PIL to save the image, which is not in the requirements file. As we are already requiring opencv, use that to save images instead of an additional dependency Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--utils/tuning/libtuning/utils.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/utils/tuning/libtuning/utils.py b/utils/tuning/libtuning/utils.py
index 87234140..90fd7072 100644
--- a/utils/tuning/libtuning/utils.py
+++ b/utils/tuning/libtuning/utils.py
@@ -5,6 +5,7 @@
#
# Utilities for libtuning
+import cv2
import decimal
import math
import numpy as np
@@ -162,6 +163,6 @@ def visualise_macbeth_chart(macbeth_rgb, original_rgb, new_rgb, output_filename)
for g in range(100):
image[xlocation + i, ylocation + g] = new_rgb[colorindex]
- img = Image.fromarray(image, 'RGB')
- img.save(str(output_filename) + 'Generated Macbeth Chart.png')
+ im_bgr = cv2.cvtColor(image, cv2.COLOR_RGB2BGR)
+ cv2.imwrite(f'{output_filename} Generated Macbeth Chart.png', im_bgr)