{"id":20600,"url":"https://patchwork.libcamera.org/api/patches/20600/?format=json","web_url":"https://patchwork.libcamera.org/patch/20600/","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":"<20240705144209.418906-12-stefan.klug@ideasonboard.com>","date":"2024-07-05T14:41:47","name":"[v4,11/23] libtuning: Reactivate macbeth locator","commit_ref":null,"pull_url":null,"state":"accepted","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/20600/mbox/","series":[{"id":4446,"url":"https://patchwork.libcamera.org/api/series/4446/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4446","date":"2024-07-05T14:41:36","name":"Add ccm calibration to libtuning","version":4,"mbox":"https://patchwork.libcamera.org/series/4446/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/20600/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/20600/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 88F03BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  5 Jul 2024 14:42:44 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3783C63367;\n\tFri,  5 Jul 2024 16:42:44 +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 8E6DC619C7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  5 Jul 2024 16:42:41 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:60b6:33a3:3a20:6030])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0B097B63;\n\tFri,  5 Jul 2024 16:42:12 +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=\"pKNEMzCG\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1720190532;\n\tbh=NQxC+aEl2HyF2pCjsNB1ZWmasD5Cd8dcHrEFL15yVNw=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=pKNEMzCG/2DwBPVwtQp9h8C7BgNXX3GyxZxURhjOZkV/thybKCizwt3hPMKwvRigs\n\tEm9jyx2PwCc1sW5oVdrhuCXqhAQLKcmgJq7UXN/nMwa5bYCmT2MuvTDlwZ6zc4mt30\n\tsfD+RiYB6OjVj7aH+VEabRpNH85ELp4HDvZhpvf0=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tPaul Elder <paul.elder@ideasonboard.com>","Subject":"[PATCH v4 11/23] libtuning: Reactivate macbeth locator","Date":"Fri,  5 Jul 2024 16:41:47 +0200","Message-ID":"<20240705144209.418906-12-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","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.\nThis solution is not very nice, and should be refactored soon. For that\nwe need a concept to collect temperature and/or image specific results\nin a central place. For now it serves the purpose.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\nReviewed-by: Paul Elder <paul.elder@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":["v4","11/23"]}