From patchwork Wed Jul 3 14:16:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 20522 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 40CD2BEFBE for ; Wed, 3 Jul 2024 14:17:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E47CF63339; Wed, 3 Jul 2024 16:17:58 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="PghGND7c"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B1D2063339 for ; Wed, 3 Jul 2024 16:17:55 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:9263:c199:9587:576]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 961C44CA; Wed, 3 Jul 2024 16:17:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1720016247; bh=dTqRfHvl3XMGum+nbZJgo4z99tFr+h4U19miy1r5r2o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PghGND7c5ggRl/1MRwQPng6uWxG+Wqm+QljKqIjVL2j/FNZ5XmL2thSKG7ZJH6eUV Dd8Q3T0qagrGiZyjnZZakqBtKOAWJL4MuuuUq6uQFlztTJTClkKEY/QDd0bMjjwdqC n0iVt/HURjidzg2/kYeVdjkUdyjrkJNsITjM408Q= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Paul Elder , Laurent Pinchart Subject: [PATCH v3 08/23] libtuning: Fix visualize_macbeth_chart() Date: Wed, 3 Jul 2024 16:16:57 +0200 Message-ID: <20240703141726.252368-9-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240703141726.252368-1-stefan.klug@ideasonboard.com> References: <20240703141726.252368-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)