Patch Detail
Show a patch.
GET /api/1.1/patches/22495/?format=api
{ "id": 22495, "url": "https://patchwork.libcamera.org/api/1.1/patches/22495/?format=api", "web_url": "https://patchwork.libcamera.org/patch/22495/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/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": "<20250109115412.356768-9-stefan.klug@ideasonboard.com>", "date": "2025-01-09T11:53:59", "name": "[v1,08/11] libtuning: module: awb: Add bayes AWB support", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "de6ea1e346099e0997e6e08b35e52312f3165c5a", "submitter": { "id": 184, "url": "https://patchwork.libcamera.org/api/1.1/people/184/?format=api", "name": "Stefan Klug", "email": "stefan.klug@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/22495/mbox/", "series": [ { "id": 4938, "url": "https://patchwork.libcamera.org/api/1.1/series/4938/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4938", "date": "2025-01-09T11:53:51", "name": "Add Bayesian AWB algorithm to libipa and rkisp1", "version": 1, "mbox": "https://patchwork.libcamera.org/series/4938/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/22495/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/22495/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 B367DC32EA\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 9 Jan 2025 11:55:33 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 2FA5768536;\n\tThu, 9 Jan 2025 12:55:33 +0100 (CET)", "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 864D668516\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 9 Jan 2025 12:55:27 +0100 (CET)", "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:93b9:eca8:897d:eae6])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id D594F6F3;\n\tThu, 9 Jan 2025 12:54:33 +0100 (CET)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"R4FHUePN\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1736423673;\n\tbh=TJbTuznBSn4VRnnE9XyebP476AFHHF98ZfIO1m1aLWY=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=R4FHUePNiQbngTC1yzUTkj7iEOGUA563OBr75THxjHmnI/U7LMtLt1IUwOSgnAxQ0\n\tYFLRdReKw+5g4O3vkTJqa/KDTsbbUirxQ50Kv5kWPUTFN3NmtxlzjPGHEDSho513z4\n\tZFq3vs5ACeYoUv3qZ+Kd2Xq4EgE71qMzS2DEiR3c=", "From": "Stefan Klug <stefan.klug@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>", "Subject": "[PATCH v1 08/11] libtuning: module: awb: Add bayes AWB support", "Date": "Thu, 9 Jan 2025 12:53:59 +0100", "Message-ID": "<20250109115412.356768-9-stefan.klug@ideasonboard.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20250109115412.356768-1-stefan.klug@ideasonboard.com>", "References": "<20250109115412.356768-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": "To support the bayesian AWB algorithm in libtuning, the necessary data\nneeds to be collected and written to the tuning file.\n\nPrior probabilities and AwbModes are defined by the user and therefore\nadded to the example config file.\n\nExtend the output to also contain the necessary data for the bayesian\nAWB algorithm.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n utils/tuning/config-example.yaml | 34 +++++++++++++++++++-\n utils/tuning/libtuning/modules/awb/awb.py | 16 +++++----\n utils/tuning/libtuning/modules/awb/rkisp1.py | 21 ++++++++----\n 3 files changed, 58 insertions(+), 13 deletions(-)", "diff": "diff --git a/utils/tuning/config-example.yaml b/utils/tuning/config-example.yaml\nindex 1b7f52cd2fff..30e88341df01 100644\n--- a/utils/tuning/config-example.yaml\n+++ b/utils/tuning/config-example.yaml\n@@ -5,7 +5,39 @@ general:\n do_alsc_colour: 1\n luminance_strength: 0.5\n awb:\n- greyworld: 0\n+ # Algorithm can be either 'grey' or 'bayes'\n+ algorithm: bayes\n+ # priors is only used for the bayes algorithm\n+ priors:\n+ - lux: 0\n+ ct: [ 2000, 13000]\n+ probability: [ 1.0, 1.0 ]\n+ AwbMode:\n+ AwbAuto:\n+ lo: 2500\n+ hi: 8000\n+ AwbIncandescent:\n+ lo: 2500\n+ hi: 3000\n+ AwbTungsten:\n+ lo: 3000\n+ hi: 3500\n+ AwbFluorescent:\n+ lo: 4000\n+ hi: 4700\n+ AwbIndoor:\n+ lo: 3000\n+ hi: 5000\n+ AwbDaylight:\n+ lo: 5500\n+ hi: 6500\n+ AwbCloudy:\n+ lo: 6500\n+ hi: 8000\n+ # One custom mode can be defined if needed\n+ #AwbCustom:\n+ # lo: 2000\n+ # hi: 1300\n macbeth:\n small: 1\n show: 0\ndiff --git a/utils/tuning/libtuning/modules/awb/awb.py b/utils/tuning/libtuning/modules/awb/awb.py\nindex c154cf3b8609..0dc4f59dcb26 100644\n--- a/utils/tuning/libtuning/modules/awb/awb.py\n+++ b/utils/tuning/libtuning/modules/awb/awb.py\n@@ -27,10 +27,14 @@ class AWB(Module):\n \n imgs = [img for img in images if img.macbeth is not None]\n \n- gains, _, _ = awb(imgs, None, None, False)\n- gains = np.reshape(gains, (-1, 3))\n+ ct_curve, transverse_pos, transverse_neg = awb(imgs, None, None, False)\n+ ct_curve = np.reshape(ct_curve, (-1, 3))\n+ gains = [{\n+ 'ct': int(v[0]),\n+ 'gains': [float(1.0 / v[1]), float(1.0 / v[2])]\n+ } for v in ct_curve]\n+\n+ return {'colourGains': gains,\n+ 'transversePos': transverse_pos,\n+ 'transverseNeg': transverse_neg}\n \n- return [{\n- 'ct': int(v[0]),\n- 'gains': [float(1.0 / v[1]), float(1.0 / v[2])]\n- } for v in gains]\ndiff --git a/utils/tuning/libtuning/modules/awb/rkisp1.py b/utils/tuning/libtuning/modules/awb/rkisp1.py\nindex 0c95843b83d3..d562d26eb8cc 100644\n--- a/utils/tuning/libtuning/modules/awb/rkisp1.py\n+++ b/utils/tuning/libtuning/modules/awb/rkisp1.py\n@@ -6,9 +6,6 @@\n \n from .awb import AWB\n \n-import libtuning as lt\n-\n-\n class AWBRkISP1(AWB):\n hr_name = 'AWB (RkISP1)'\n out_name = 'Awb'\n@@ -20,8 +17,20 @@ class AWBRkISP1(AWB):\n return True\n \n def process(self, config: dict, images: list, outputs: dict) -> dict:\n- output = {}\n-\n- output['colourGains'] = self.do_calculation(images)\n+ if not 'awb' in config['general']:\n+ raise ValueError('AWB configuration missing')\n+ awb_config = config['general']['awb']\n+ algorithm = awb_config['algorithm']\n+\n+ output = {'algorithm': algorithm}\n+ data = self.do_calculation(images)\n+ if algorithm == 'grey':\n+ output['colourGains'] = data['colourGains']\n+ elif algorithm == 'bayes':\n+ output['AwbMode'] = awb_config['AwbMode']\n+ output['priors'] = awb_config['priors']\n+ output.update(data)\n+ else:\n+ raise ValueError(f\"Unknown AWB algorithm {output['algorithm']}\")\n \n return output\n", "prefixes": [ "v1", "08/11" ] }