[{"id":30298,"web_url":"https://patchwork.libcamera.org/comment/30298/","msgid":"<ZoZnrHONwLA48ykn@pyrite.rasen.tech>","date":"2024-07-04T09:13:16","subject":"Re: [PATCH v3 11/23] libtuning: Reactivate macbeth locator","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Wed, Jul 03, 2024 at 04:17:00PM +0200, Stefan Klug wrote:\n> Add the missing pieces and store the result inside the image object.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\nReviewed-by: Paul Elder <paul.elder@ideasonboard.com>\n\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(-)\n> \n> diff --git a/utils/tuning/libtuning/image.py b/utils/tuning/libtuning/image.py\n> index 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()\n> diff --git a/utils/tuning/libtuning/macbeth.py b/utils/tuning/libtuning/macbeth.py\n> index 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\n> diff --git a/utils/tuning/libtuning/utils.py b/utils/tuning/libtuning/utils.py\n> index 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> -- \n> 2.43.0\n>","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 42237BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  4 Jul 2024 09:13:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 02BFD62E25;\n\tThu,  4 Jul 2024 11:13:25 +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 3BCA462E01\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  4 Jul 2024 11:13:23 +0200 (CEST)","from pyrite.rasen.tech (h175-177-049-156.catv02.itscom.jp\n\t[175.177.49.156])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7BCDB3A2;\n\tThu,  4 Jul 2024 11:12:53 +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=\"wIiNASYI\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1720084374;\n\tbh=EbCSS/OOn36mTxRUp5syjfcINXmtNy9eAi6qqUaPFsc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=wIiNASYIU7kVz4ZAsobAwdqm2h+QJWWM+9exFnnEgkqcTM0t0Xe/Ytc6qLT64CscR\n\tk/Dmhn/4ShIQ10Bk2FqWr5YneaTGAVXRTOH54Y1yjuNpvzL0To7llRTl/dKsRVeq9O\n\twzAUbNN5xVaLSI5SDOjNFwqAbn/VFYCJtjR1xrbA=","Date":"Thu, 4 Jul 2024 18:13:16 +0900","From":"Paul Elder <paul.elder@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v3 11/23] libtuning: Reactivate macbeth locator","Message-ID":"<ZoZnrHONwLA48ykn@pyrite.rasen.tech>","References":"<20240703141726.252368-1-stefan.klug@ideasonboard.com>\n\t<20240703141726.252368-12-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<20240703141726.252368-12-stefan.klug@ideasonboard.com>","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>"}}]