From patchwork Fri Jun 28 10:47:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 20467 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 04465BD87C for ; Fri, 28 Jun 2024 10:49:05 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B0B8462E1F; Fri, 28 Jun 2024 12:49:04 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="KScyQF5V"; 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 AE72162CA0 for ; Fri, 28 Jun 2024 12:49:02 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:82ab:924:d918:cd24]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 33619BEB; Fri, 28 Jun 2024 12:48:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1719571718; bh=QyPUM1BVkguvQnhuDsl4Z9U69vNSNHJYHqF/8sIxgnY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KScyQF5VMVOLZg/czkrc6DkJub7MGg61aKmYCs7e3v3JXj/W7nZsoqsIu93zGh2zu pM72E/bYlQme441B79IZYUDO4s5xb/gTKSnJONUt044kl/sgFmOk32/LsoDPNo6FJI 20oiECukEZ/M07QZMwQl1GRaMWU6y00JikJAObFk= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Paul Elder Subject: [PATCH v2 08/25] libtuning: Fix visualize_macbeth_chart() Date: Fri, 28 Jun 2024 12:47:01 +0200 Message-ID: <20240628104828.2928109-9-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240628104828.2928109-1-stefan.klug@ideasonboard.com> References: <20240628104828.2928109-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..178c6957c581 100644 --- a/utils/tuning/libtuning/utils.py +++ b/utils/tuning/libtuning/utils.py @@ -7,6 +7,7 @@ import decimal import math +import cv2 import numpy as np import os from pathlib import Path @@ -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)