{"id":20525,"url":"https://patchwork.libcamera.org/api/patches/20525/?format=json","web_url":"https://patchwork.libcamera.org/patch/20525/","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":"<20240703141726.252368-12-stefan.klug@ideasonboard.com>","date":"2024-07-03T14:17:00","name":"[v3,11/23] libtuning: Reactivate macbeth locator","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"336b830ff99818f6e717d95b5defa0f628f7fd04","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/20525/mbox/","series":[{"id":4437,"url":"https://patchwork.libcamera.org/api/series/4437/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4437","date":"2024-07-03T14:16:49","name":"Add ccm calibration to libtuning","version":3,"mbox":"https://patchwork.libcamera.org/series/4437/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20525/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20525/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 A1709BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  3 Jul 2024 14:18:08 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5901763363;\n\tWed,  3 Jul 2024 16:18:08 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2445F63365\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  3 Jul 2024 16:18:05 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:9263:c199:9587:576])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0532F4CA;\n\tWed,  3 Jul 2024 16:17:36 +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=\"i2W1EZPQ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1720016257;\n\tbh=WDvuEgRZJSn8ft56e1J+vD0dxPn56D/Aap9b1kKGZWM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=i2W1EZPQfW8OFdxnwJvlHebWeQ7Gno/i8CX1HYnUTGTgj3qcE8J2LlWVKmt1tkP1b\n\tfDACb0Ycq4aB6PI+2s00gDBBzebJy1w3ObUSNq9lUe51xijmHMO34ZOEED/lX0L58B\n\tJDlAxiQQao0cXk7JdcdLif24VSGQfoWWDQ7frDis=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v3 11/23] libtuning: Reactivate macbeth locator","Date":"Wed,  3 Jul 2024 16:17:00 +0200","Message-ID":"<20240703141726.252368-12-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","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   |  4 ++--\n 3 files changed, 13 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 c70dfae049bc..93c6c94ea2b0 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@@ -127,7 +127,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":["v3","11/23"]}