{"id":20470,"url":"https://patchwork.libcamera.org/api/patches/20470/?format=json","web_url":"https://patchwork.libcamera.org/patch/20470/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20240628104828.2928109-12-stefan.klug@ideasonboard.com>","date":"2024-06-28T10:47:04","name":"[v2,11/25] libtuning: Reactivate macbeth locator","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"d47fa72994a8c155c240f07ee876009f1fb1e8a4","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/20470/mbox/","series":[{"id":4430,"url":"https://patchwork.libcamera.org/api/series/4430/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4430","date":"2024-06-28T10:46:53","name":"Add ccm calibration to libtuning","version":2,"mbox":"https://patchwork.libcamera.org/series/4430/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20470/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20470/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 9EF4CBD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 28 Jun 2024 10:49:12 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5B2E363334;\n\tFri, 28 Jun 2024 12:49:12 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 39B0862E24\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 28 Jun 2024 12:49:11 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:82ab:924:d918:cd24])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AC4CDBEB;\n\tFri, 28 Jun 2024 12:48:46 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"GKHdq86Y\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1719571726;\n\tbh=7qUzQm//9uS++Ox+3OHVBDUwZ30c0c21SziG6NOnYcA=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=GKHdq86YLT5c1ob52X2XjhRmpZMWUf6L2kle7zJSheTRARDPHBewogTsO3LY+x+uH\n\tllzAeWgAps/8fyU1aKLskH6SZ6D/qn3PvWZJM7wI8LrXm+Ckxg/4NHnfwV4t2imcwj\n\tz6EdCSq1dKxflV94cZ+/EWhKr4ZqRqJkbyyyYAbg=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v2 11/25] libtuning: Reactivate macbeth locator","Date":"Fri, 28 Jun 2024 12:47:04 +0200","Message-ID":"<20240628104828.2928109-12-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","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Add the missing pieces and store the result inside the image object.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n utils/tuning/libtuning/image.py   |  1 +\n utils/tuning/libtuning/macbeth.py | 13 ++++++++++---\n utils/tuning/libtuning/utils.py   |  5 +++--\n 3 files changed, 14 insertions(+), 5 deletions(-)","diff":"diff --git a/utils/tuning/libtuning/image.py b/utils/tuning/libtuning/image.py\nindex 2c4d774f11e2..c8911a0ff125 100644\n--- a/utils/tuning/libtuning/image.py\n+++ b/utils/tuning/libtuning/image.py\n@@ -24,6 +24,7 @@ class Image:\n         self.lsc_only = False\n         self.color = -1\n         self.lux = -1\n+        self.macbeth = None\n \n         try:\n             self._load_metadata_exif()\ndiff --git a/utils/tuning/libtuning/macbeth.py b/utils/tuning/libtuning/macbeth.py\nindex 28051de8155c..4a2006b013dc 100644\n--- a/utils/tuning/libtuning/macbeth.py\n+++ b/utils/tuning/libtuning/macbeth.py\n@@ -17,12 +17,15 @@ import logging\n from sklearn import cluster as cluster\n \n from .ctt_ransac import get_square_verts, get_square_centres\n-\n-from libtuning.image import Image\n+from .image import Image\n \n logger = logging.getLogger(__name__)\n \n \n+class MacbethError(Exception):\n+    pass\n+\n+\n # Reshape image to fixed width without distorting returns image and scale\n # factor\n def reshape(img, width):\n@@ -377,7 +380,9 @@ def get_macbeth_chart(img, ref_data):\n \n     # Catch macbeth errors and continue with code\n     except MacbethError as error:\n-        logger.warning(error)\n+        # \\todo: This happens so many times in a normal run, that it shadows\n+        # all the relevant output\n+        # logger.warning(error)\n         return (0, None, None, False)\n \n \n@@ -527,4 +532,6 @@ def locate_macbeth(image: Image, config: dict):\n         logger.warning(f'Macbeth patches have saturated in {image.path.name}')\n         return None\n \n+    image.macbeth = macbeth\n+\n     return macbeth\ndiff --git a/utils/tuning/libtuning/utils.py b/utils/tuning/libtuning/utils.py\nindex 00cf5a57512f..1e7991e84a70 100644\n--- a/utils/tuning/libtuning/utils.py\n+++ b/utils/tuning/libtuning/utils.py\n@@ -17,7 +17,7 @@ import logging\n \n import libtuning as lt\n from libtuning.image import Image\n-from libtuning.macbeth import locate_macbeth\n+from .macbeth import locate_macbeth\n \n logger = logging.getLogger(__name__)\n \n@@ -92,6 +92,7 @@ def load_images(input_dir: str, config: dict, load_nonlsc: bool, load_lsc: bool)\n     images = []\n     for f in files:\n         color, lux, lsc_only = _parse_image_filename(f)\n+        logger.info(f'Process image {f.name} (color={color}, lux={lux}, lsc_only={lsc_only})')\n         if color is None:\n             continue\n \n@@ -127,7 +128,7 @@ def load_images(input_dir: str, config: dict, load_nonlsc: bool, load_lsc: bool)\n             continue\n \n         # Handle macbeth\n-        macbeth = locate_macbeth(config)\n+        macbeth = locate_macbeth(image, config)\n         if macbeth is None:\n             continue\n \n","prefixes":["v2","11/25"]}