Patch Detail
Show a patch.
GET /api/patches/23294/?format=api
{ "id": 23294, "url": "https://patchwork.libcamera.org/api/patches/23294/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23294/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20250428103604.151551-3-david.plowman@raspberrypi.com>", "date": "2025-04-28T10:36:04", "name": "[2/2] utils: raspberrypi: ctt: Fix NaNs in chromatic aberration tables", "commit_ref": "17e41b2a3a144a80e60f28e15a4c2aaa42c87105", "pull_url": null, "state": "accepted", "archived": false, "hash": "a0a61d00d9dd4e87716519f8268f552afc2945ee", "submitter": { "id": 42, "url": "https://patchwork.libcamera.org/api/people/42/?format=api", "name": "David Plowman", "email": "david.plowman@raspberrypi.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/23294/mbox/", "series": [ { "id": 5149, "url": "https://patchwork.libcamera.org/api/series/5149/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5149", "date": "2025-04-28T10:36:02", "name": "Raspberry Pi Camera Tuning Tool fixes", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5149/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23294/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23294/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 C982CC331E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 28 Apr 2025 10:36:15 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6EFE868AD9;\n\tMon, 28 Apr 2025 12:36:12 +0200 (CEST)", "from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com\n\t[IPv6:2a00:1450:4864:20::32f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4B51D68AD0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Apr 2025 12:36:09 +0200 (CEST)", "by mail-wm1-x32f.google.com with SMTP id\n\t5b1f17b1804b1-43cfa7e7f54so30651475e9.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 28 Apr 2025 03:36:09 -0700 (PDT)", "from davidp-xps-13.pitowers.org\n\t([2a00:1098:3142:1f:6594:d5bc:c5ae:99b5])\n\tby smtp.gmail.com with ESMTPSA id\n\t5b1f17b1804b1-4408d04802fsm116243185e9.1.2025.04.28.03.36.07\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tMon, 28 Apr 2025 03:36:08 -0700 (PDT)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=raspberrypi.com header.i=@raspberrypi.com\n\theader.b=\"q5QEHmAy\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google; t=1745836568; x=1746441368;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:from:to:cc:subject:date\n\t:message-id:reply-to;\n\tbh=5joiZvz1p7nQlQ68R/6+IBWH9tU58Kcenv9xI4HsEGU=;\n\tb=q5QEHmAyL2GIIT7usy4b/TeSQ3YnuAXnP0P+BgJ/YSz2Fn4tEztBUtmT7SwVDkKPrU\n\toxoJEqnpeafTgURDWw5d474+Y7kybASVQjDhesZBuz6HaTi3PbpagS7V0bEf6XOexMe4\n\t6e1YNGt+CePRie7g3AYw9YDgUZfSHTDYsRRmkWb8NxttQrs0kg28kEcckcUS9Cv/TNYS\n\tEdGMGWoqvzkFaJdUcYrsdkOvcf6Qw+OFgFURuKnBV+pN4Y2ksyw40kFtWaYj6ijvg6io\n\tAYKiYnn+VB2p7myOppdVyBGEB8aL4KGSyD5GRhDV7Tuj+qh1pvBmVD9x3yDtBiEjGq2Q\n\t9mJA==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1745836568; x=1746441368;\n\th=content-transfer-encoding:mime-version:references:in-reply-to\n\t:message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n\t:subject:date:message-id:reply-to;\n\tbh=5joiZvz1p7nQlQ68R/6+IBWH9tU58Kcenv9xI4HsEGU=;\n\tb=l30Fg8Pqfj/OdY034Xu524RKgwcswPGeFSWPLsNePaRF9uLMSMl1rJz7Y+7NGs9bgv\n\t8hZTLadW2RtLM6xVMiQ3zbqjpYADiNwOO2sLj3oK5nGKFxlr2Xpbhv5RpX00YGS69M9k\n\tFH33+fMLB4+3xLuPbddPa/PWDAwYAh61f36jzd+c83haO2G5KbnX6Zye8lR3yG0pHS1s\n\tyDb2dVxOrwEL94p3FNYH/BrEaNY9fPEu4aEJuxggTB4c4XHJpU45x+KBZozUShJrqtbL\n\teJytErdIzQKk7m+f3DiXD6Ll8C3OMM+4BwxCb6D4YlwyiqymwyWpLKJx4/dxZ8OLr2ZD\n\th5Cw==", "X-Gm-Message-State": "AOJu0YwMluEz44GiG9R6jc4oY1aMja/kgEOlP9OB5mH3AiGXSYE16VgU\n\t/CcLJSiL5R8HUJj9FkLPVaPHHATXGu+TeJiWmBdAHubcpXotKxTqXgjhiHHnmHeISDQPV+gbpXF\n\tS", "X-Gm-Gg": "ASbGnctrHEnqe3wWY5lYCwBFv2l5qEQ0zvFltJ9jChS8uZsl5S/E3rofvw+yxx19UqP\n\tLVMxKzwqCz86hwUyqRY3G8C2LBPkiyDe45xT7U1ehUWRhB+s5Xl23U9bD0krkjN8QsQXTvBriLo\n\t+5qGNeoFuI8rVVlL/8wJ6hUDbISFNeRET+Q+Gg5wur7keQDaq74FQ40hstxGqBPa5NLnX37/7mT\n\tQWmK1Xvd/GO31n3EcX5ECEDTOOmG1SmFx7HifPErhq5jq3QQuGOwtmjPqq9JN6IUs2uje0TCoYt\n\t7kLSqcfQ6TWX4zVLKNtu6nmDNMZq0OAdMLR8ng5PRpDqay2FlEwoUco7po+cDl2q3QckoNpklj8\n\t=", "X-Google-Smtp-Source": "AGHT+IEJM97PuEIzwjCkmFxV69yMZCbt4WyGxzjTDorpWFG64qxiJFATuVIVmCqRQWsDg5MIIpWljw==", "X-Received": "by 2002:a05:600c:1d81:b0:439:4c1e:d810 with SMTP id\n\t5b1f17b1804b1-440a65eeacdmr88407495e9.9.1745836568513; \n\tMon, 28 Apr 2025 03:36:08 -0700 (PDT)", "From": "David Plowman <david.plowman@raspberrypi.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "David Plowman <david.plowman@raspberrypi.com>", "Subject": "[PATCH 2/2] utils: raspberrypi: ctt: Fix NaNs in chromatic\n\taberration tables", "Date": "Mon, 28 Apr 2025 11:36:04 +0100", "Message-Id": "<20250428103604.151551-3-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20250428103604.151551-1-david.plowman@raspberrypi.com>", "References": "<20250428103604.151551-1-david.plowman@raspberrypi.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": "NaNs can appear if no black dots can be found and analysed in a\nparticular region of the calibration image. There needs to be at least\none such dot in every 8x8 cell covering the image.\n\nThis is now detected, and an error message issued. No CAC tables are\ngenerated, so CAC is disabled.\n\nSigned-off-by: David Plowman <david.plowman@raspberrypi.com>\n---\n utils/raspberrypi/ctt/ctt.py | 9 ++++++---\n utils/raspberrypi/ctt/ctt_cac.py | 32 +++++++++++++++++++++++++++-----\n 2 files changed, 33 insertions(+), 8 deletions(-)", "diff": "diff --git a/utils/raspberrypi/ctt/ctt.py b/utils/raspberrypi/ctt/ctt.py\nindex 96f1b5e6..186afda5 100755\n--- a/utils/raspberrypi/ctt/ctt.py\n+++ b/utils/raspberrypi/ctt/ctt.py\n@@ -198,9 +198,12 @@ class Camera:\n \"\"\"\n Write output to json\n \"\"\"\n- self.json['rpi.cac']['cac'] = cacs\n- self.log += '\\nCAC calibration written to json file'\n- print('Finished CAC calibration')\n+ if cacs:\n+ self.json['rpi.cac']['cac'] = cacs\n+ self.log += '\\nCAC calibration written to json file'\n+ print('Finished CAC calibration')\n+ else:\n+ self.log += \"\\nCAC calibration failed\"\n \n \n \"\"\"\ndiff --git a/utils/raspberrypi/ctt/ctt_cac.py b/utils/raspberrypi/ctt/ctt_cac.py\nindex 5a4c5101..a1183989 100644\n--- a/utils/raspberrypi/ctt/ctt_cac.py\n+++ b/utils/raspberrypi/ctt/ctt_cac.py\n@@ -108,12 +108,29 @@ def shifts_to_yaml(red_shift, blue_shift, image_dimensions, output_grid_size=9):\n ybsgrid[xgridloc][ygridloc].append(blue_shift[3])\n \n # Now calculate the average pixel shift for each square in the grid\n+ grid_incomplete = False\n for x in range(output_grid_size - 1):\n for y in range(output_grid_size - 1):\n- xrgrid[x, y] = np.mean(xrsgrid[x][y])\n- yrgrid[x, y] = np.mean(yrsgrid[x][y])\n- xbgrid[x, y] = np.mean(xbsgrid[x][y])\n- ybgrid[x, y] = np.mean(ybsgrid[x][y])\n+ if xrsgrid[x][y]:\n+ xrgrid[x, y] = np.mean(xrsgrid[x][y])\n+ else:\n+ grid_incomplete = True\n+ if yrsgrid[x][y]:\n+ yrgrid[x, y] = np.mean(yrsgrid[x][y])\n+ else:\n+ grid_incomplete = True\n+ if xbsgrid[x][y]:\n+ xbgrid[x, y] = np.mean(xbsgrid[x][y])\n+ else:\n+ grid_incomplete = True\n+ if ybsgrid[x][y]:\n+ ybgrid[x, y] = np.mean(ybsgrid[x][y])\n+ else:\n+ grid_incomplete = True\n+\n+ if grid_incomplete:\n+ raise RuntimeError(\"\\nERROR: CAC measurements do not span the image!\"\n+ \"\\nConsider using improved CAC images, or remove them entirely.\\n\")\n \n # Next, we start to interpolate the central points of the grid that gets passed to the tuning file\n input_grids = np.array([xrgrid, yrgrid, xbgrid, ybgrid])\n@@ -219,7 +236,12 @@ def cac(Cam):\n # tuning file\n print(\"\\nCreating output grid\")\n Cam.log += '\\nCreating output grid'\n- rx, ry, bx, by = shifts_to_yaml(red_shift, blue_shift, image_size)\n+ try:\n+ rx, ry, bx, by = shifts_to_yaml(red_shift, blue_shift, image_size)\n+ except RuntimeError as e:\n+ print(str(e))\n+ Cam.log += \"\\nCAC correction failed! CAC will not be enabled.\"\n+ return {}\n \n print(\"CAC correction complete!\")\n Cam.log += '\\nCAC correction complete!'\n", "prefixes": [ "2/2" ] }