Patch Detail
Show a patch.
GET /api/patches/16563/?format=api
{ "id": 16563, "url": "https://patchwork.libcamera.org/api/patches/16563/?format=api", "web_url": "https://patchwork.libcamera.org/patch/16563/", "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": "<20220706101836.20153-3-david.plowman@raspberrypi.com>", "date": "2022-07-06T10:18:35", "name": "[libcamera-devel,2/3] utils: raspberrypi: ctt: Add alsc_only method", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "c8c568be198513364aa5f5dc416d3762b09dd907", "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/16563/mbox/", "series": [ { "id": 3261, "url": "https://patchwork.libcamera.org/api/series/3261/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3261", "date": "2022-07-06T10:18:33", "name": "Raspberry Pi tuning tool improvements", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3261/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/16563/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/16563/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 80BA8BD1F1\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 6 Jul 2022 10:18:47 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7F26763313;\n\tWed, 6 Jul 2022 12:18:45 +0200 (CEST)", "from mail-wr1-x430.google.com (mail-wr1-x430.google.com\n\t[IPv6:2a00:1450:4864:20::430])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 836BD6330E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 6 Jul 2022 12:18:42 +0200 (CEST)", "by mail-wr1-x430.google.com with SMTP id o4so21376613wrh.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 06 Jul 2022 03:18:42 -0700 (PDT)", "from pi4-davidp.pitowers.org\n\t([2a00:1098:3142:14:e4a2:3070:eea4:e434])\n\tby smtp.gmail.com with ESMTPSA id\n\ti1-20020adffc01000000b0021b5861eaf7sm35950820wrr.3.2022.07.06.03.18.41\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tWed, 06 Jul 2022 03:18:41 -0700 (PDT)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1657102725;\n\tbh=uyKuipDDdz/XZhk1uvlh59NH/oIDbLiIp/gjCbAu/q8=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=H8CZpkXfWsVPVUtRvdOUNDPSMR/ILlGWjlOOAM3zYJXy9cn7yUxJSdpDxkAS5xYt4\n\tomjnoxKb+vYammX7URLB9E8cO4Yy//WJa44huyukQcMURchVEidgk0W1gfp50zpUfi\n\tKcEAbpUSMdb6exyTcWStERK4mUSkYUQdOtN02w389aUS/lnJ2S3CP7TvqHwqdhwEzr\n\tY55VrlWymz2niuJyxYOLx6iGwhk6mpgO7aniAu8thWvfrcvU28RNLMWkb3BPj485yR\n\tmKFsPF1v8WXIOmUOq6jNIfg4srLqWzs5mFVEhjmlRehaZhzhFq5SkkGqcNJsJr2nIV\n\tn6CiWuZVj485Q==", "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=from:to:subject:date:message-id:in-reply-to:references:mime-version\n\t:content-transfer-encoding;\n\tbh=TFoDYgGxHC/i4sL9ves7P72QTIn58Xk+z4xJBL6J09M=;\n\tb=HpEQOljtCgBhPkhwAAMgF8PL/bWj0mJ573Ccz/fSBlwGySb4YPyYm3DEWhhiiNauMz\n\tK4Ef58TTVvRyrp9oo8Gcz3bVgCWUKDvmFAO5w38aL2l+kgrFrxpN6B2p6ZIwnpW0Ta4+\n\tFNh7kOR7A7s+zOXn618FQdffvCzvoc5ZwdDKxfqCMWSUxL6zFL9GE+hk6ad7Dd8U9Dcl\n\tsO9Lb5+HmpjJ4kdaM3EMXNSBXiXFhS8NlYGsR+tyoOert2BVdySY4XIUYrFLM9NRRiGo\n\t7Fi+PazM7RJNnNmveKhH+EEWKyjURd0KYovu3ctg1+FeNecp5Fh9KqIDAssXlpbxIQio\n\tHUtg==" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"HpEQOljt\"; dkim-atps=neutral", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:from:to:subject:date:message-id:in-reply-to\n\t:references:mime-version:content-transfer-encoding;\n\tbh=TFoDYgGxHC/i4sL9ves7P72QTIn58Xk+z4xJBL6J09M=;\n\tb=ViblyE37UU3Om9E28PqZw9IfQhFujcLvUXM2Z7Q+cuaje9w+1tN11+xo/LEN5BaACU\n\tAQTTGe9O5P2ATIT6nMC3972mUsDcHdVp3ZEKx+WIg2Msam9ZCY9lnHbhhGK/6ddQBh0w\n\tctGTFi6iVi0bCY+1G0l+kogApLUDLKL+M8cjHM1S6DWknuvyVybqFUAJ2wev9Oo3qgMK\n\t8KcuU/lSSTkKvx+K6A796vLD5hdp/Tnrfjm/gsx3CwADcK75f6NAu9EpABG2PwtXm+HQ\n\teWQGRM7G/tp/NCnzuZ00oYmuW447Vp9e5IuxMHvYbNKCUdPGVYtYimZ9QoJXI/Fats7q\n\tmitA==", "X-Gm-Message-State": "AJIora9vedaM813ECi+XaI77gm2aDMDyT/WARM4+3XPjU4BjeQsUNEsk\n\t3ziep02OlYcqm+ZaKdt3F3chT+ZFCii/sw==", "X-Google-Smtp-Source": "AGRyM1s+0ZyrFZcY8AvxCpHkb9zMKH6dlrusrIbePVpZDz7hxoJ8WoNznieEslU3v8i3mfEqQ/6TBw==", "X-Received": "by 2002:a05:6000:1a87:b0:21c:65c8:2d8 with SMTP id\n\tf7-20020a0560001a8700b0021c65c802d8mr37604684wry.370.1657102721991; \n\tWed, 06 Jul 2022 03:18:41 -0700 (PDT)", "To": "libcamera-devel@lists.libcamera.org, william.vinnicombe@raspberrypi.com", "Date": "Wed, 6 Jul 2022 11:18:35 +0100", "Message-Id": "<20220706101836.20153-3-david.plowman@raspberrypi.com>", "X-Mailer": "git-send-email 2.30.2", "In-Reply-To": "<20220706101836.20153-1-david.plowman@raspberrypi.com>", "References": "<20220706101836.20153-1-david.plowman@raspberrypi.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 2/3] utils: raspberrypi: ctt: Add\n\talsc_only method", "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>", "From": "David Plowman via libcamera-devel <libcamera-devel@lists.libcamera.org>", "Reply-To": "David Plowman <david.plowman@raspberrypi.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "From: William Vinnicombe <william.vinnicombe@raspberrypi.com>\n\nThe ctt would not work if only passed alsc images.\n\nAdded alsc_only.py to run alsc calibration only, and modified check_imgs\nto allow for no macbeth chart images.\n\nExample usage would be ./alsc_only.py -i tuning-images/ -o sensor.json\nwith the same optional arguments as the original ctt.\n\nSigned-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com>\n---\n utils/raspberrypi/ctt/alsc_only.py | 118 +++++++++++++++++++++++++++++\n utils/raspberrypi/ctt/ctt.py | 8 +-\n 2 files changed, 124 insertions(+), 2 deletions(-)\n create mode 100755 utils/raspberrypi/ctt/alsc_only.py", "diff": "diff --git a/utils/raspberrypi/ctt/alsc_only.py b/utils/raspberrypi/ctt/alsc_only.py\nnew file mode 100755\nindex 00000000..318adc8c\n--- /dev/null\n+++ b/utils/raspberrypi/ctt/alsc_only.py\n@@ -0,0 +1,118 @@\n+#!/usr/bin/env python3\n+#\n+# SPDX-License-Identifier: BSD-2-Clause\n+#\n+# Copyright (C) 2022, Raspberry Pi (Trading) Limited\n+#\n+# alsc_only.py - alsc tuning tool\n+\n+from ctt import *\n+\n+\n+def run_alsc(json_output, directory, config, log_output):\n+ \"\"\"\n+ check input files are jsons\n+ \"\"\"\n+ if json_output[-5:] != '.json':\n+ raise ArgError('\\n\\nError: Output must be a json file!')\n+ if config is not None:\n+ \"\"\"\n+ check if config file is actually a json\n+ \"\"\"\n+ if config[-5:] != '.json':\n+ raise ArgError('\\n\\nError: Config file must be a json file!')\n+ \"\"\"\n+ read configurations\n+ \"\"\"\n+ try:\n+ with open(config, 'r') as config_json:\n+ configs = json.load(config_json)\n+ except FileNotFoundError:\n+ configs = {}\n+ config = False\n+ except json.decoder.JSONDecodeError:\n+ configs = {}\n+ config = True\n+\n+ else:\n+ configs = {}\n+ \"\"\"\n+ load configurations from config file, if not given then set default\n+ only load configurations needed for alsc, and directly define others\n+ \"\"\"\n+ plot = get_config(configs, \"plot\", [], 'list')\n+ alsc_d = get_config(configs, \"alsc\", {}, 'dict')\n+ do_alsc_colour = get_config(alsc_d, \"do_alsc_colour\", 1, 'bool')\n+ luminance_strength = get_config(alsc_d, \"luminance_strength\", 0.5, 'num')\n+ blacklevel = get_config(configs, \"blacklevel\", -1, 'num')\n+ mac_config = (0, 0)\n+\n+ if blacklevel < -1 or blacklevel >= 2**16:\n+ print('\\nInvalid blacklevel, defaulted to 64')\n+ blacklevel = -1\n+\n+ if luminance_strength < 0 or luminance_strength > 1:\n+ print('\\nInvalid luminance_strength strength, defaulted to 0.5')\n+ luminance_strength = 0.5\n+\n+ \"\"\"\n+ sanitise directory path\n+ \"\"\"\n+ if directory[-1] != '/':\n+ directory += '/'\n+ \"\"\"\n+ initialise tuning tool and load images\n+ \"\"\"\n+ try:\n+ Cam = Camera(json_output)\n+ Cam.log_user_input(json_output, directory, config, log_output)\n+ disable = set(Cam.json.keys()).symmetric_difference({\"rpi.alsc\"})\n+ Cam.disable = disable\n+ Cam.plot = plot\n+ Cam.add_imgs(directory, mac_config, blacklevel)\n+ except FileNotFoundError:\n+ raise ArgError('\\n\\nError: Input image directory not found!')\n+\n+ \"\"\"\n+ preform calibrations as long as check_imgs returns True\n+ Only performs the alsc calibration\n+ \"\"\"\n+ if Cam.check_imgs(macbeth=False):\n+ Cam.json_remove(disable)\n+ print('\\nSTARTING CALIBRATIONS')\n+ Cam.alsc_cal(luminance_strength, do_alsc_colour)\n+ print('\\nFINISHED CALIBRATIONS')\n+ Cam.write_json()\n+ Cam.write_log(log_output)\n+ print('\\nCalibrations written to: '+json_output)\n+ if log_output is None:\n+ log_output = 'ctt_log.txt'\n+ print('Log file written to: '+log_output)\n+ pass\n+ else:\n+ Cam.write_log(log_output)\n+\n+\n+if __name__ == '__main__':\n+ \"\"\"\n+ initialise calibration\n+ \"\"\"\n+ if len(sys.argv) == 1:\n+ print(\"\"\"\n+ Pisp Camera Tuning Tool version 1.0\n+\n+ Required Arguments:\n+ '-i' : Calibration image directory.\n+ '-o' : Name of output json file.\n+\n+ Optional Arguments:\n+ '-c' : Config file for the CTT. If not passed, default parameters used.\n+ '-l' : Name of output log file. If not passed, 'ctt_log.txt' used.\n+ \"\"\")\n+ quit(0)\n+ else:\n+ \"\"\"\n+ parse input arguments\n+ \"\"\"\n+ json_output, directory, config, log_output = parse_input()\n+ run_alsc(json_output, directory, config, log_output)\ndiff --git a/utils/raspberrypi/ctt/ctt.py b/utils/raspberrypi/ctt/ctt.py\nindex 15064634..0ea4854d 100755\n--- a/utils/raspberrypi/ctt/ctt.py\n+++ b/utils/raspberrypi/ctt/ctt.py\n@@ -664,7 +664,7 @@ class Camera:\n - incorrect filename/extension\n - images from different cameras\n \"\"\"\n- def check_imgs(self):\n+ def check_imgs(self, macbeth=True):\n self.log += '\\n\\nImages found:'\n self.log += '\\nMacbeth : {}'.format(len(self.imgs))\n self.log += '\\nALSC : {} '.format(len(self.imgs_alsc))\n@@ -672,10 +672,14 @@ class Camera:\n \"\"\"\n check usable images found\n \"\"\"\n- if len(self.imgs) == 0:\n+ if len(self.imgs) == 0 and macbeth:\n print('\\nERROR: No usable macbeth chart images found')\n self.log += '\\nERROR: No usable macbeth chart images found'\n return 0\n+ elif len(self.imgs) == 0 and len(self.imgs_alsc) == 0:\n+ print('\\nERROR: No usable images found')\n+ self.log += '\\nERROR: No usable images found'\n+ return 0\n \"\"\"\n Double check that every image has come from the same camera...\n \"\"\"\n", "prefixes": [ "libcamera-devel", "2/3" ] }