From patchwork Fri Jul 5 14:41:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 20597 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 01299C3240 for ; Fri, 5 Jul 2024 14:42:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 964CB619C7; Fri, 5 Jul 2024 16:42:36 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="u43/5xMF"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A53BF619C7 for ; Fri, 5 Jul 2024 16:42:34 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:60b6:33a3:3a20:6030]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 260147F3; Fri, 5 Jul 2024 16:42:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1720190525; bh=dTqRfHvl3XMGum+nbZJgo4z99tFr+h4U19miy1r5r2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u43/5xMF7h/B96Itvbh6ADkOvTzDHYTePg0Bl9bX4cdgJoOoGiCxgr8fhPDyw2/zr mlL690/CuLfmKzmQE7127E16w0ow3DTRsekfO1rr4Gvomnvmpl612btWDQvDRaR5YC q051D6OBzX7n3/DUj4+/vlMrGIFb4v2VnfjsH86Y= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Paul Elder , Laurent Pinchart Subject: [PATCH v4 08/23] libtuning: Fix visualize_macbeth_chart() Date: Fri, 5 Jul 2024 16:41:44 +0200 Message-ID: <20240705144209.418906-9-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240705144209.418906-1-stefan.klug@ideasonboard.com> References: <20240705144209.418906-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 Reviewed-by: Paul Elder Reviewed-by: Laurent Pinchart --- utils/tuning/libtuning/utils.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/utils/tuning/libtuning/utils.py b/utils/tuning/libtuning/utils.py index 872341407b7b..90fd7072a0fd 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)