[{"id":22297,"web_url":"https://patchwork.libcamera.org/comment/22297/","msgid":"<CAHW6GYLW3rqbd-DHMxtFaqU_ad=-r7ZKzkPB_jxENrUWyO9viw@mail.gmail.com>","date":"2022-03-17T09:44:20","subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"Hi everyone\n\nThanks for the update!\n\nOn Mon, 14 Mar 2022 at 15:46, Tomi Valkeinen\n<tomi.valkeinen@ideasonboard.com> wrote:\n>\n> Hi,\n>\n> This is v5 of the series. The changes to v4:\n>\n> - Changed to pybind11 'smart_holders' branch which allows us to drop the\n>   HACK for Camera public destructor\n> - Changed Request.set_control() so that we can drop the HACK for\n>   exposing Camera from Request\n> - Moved Python enum defs to a separate file for clarity\n> - \"Forward\" declare Python classes to fix docstring issues.\n>\n> The set_control change breaks the current users of that function.\n> Previously you could do this:\n>\n> req.set_control(\"Brightness\", 1)\n>\n> Now you need to do:\n>\n> cid = camera.find_control(\"Brightness\")\n> req.set_control(cid, 1)\n>\n\nI see the need for this, and I guess it's fine - obviously we'll hide\nthat under our Picamera2 API as we wouldn't want our users to have to\ndo that!\n\nThere is one further thing I wanted to raise in relation to the Python\nbindings for controls, now that a few folks are trying out Picamera2.\n\nI've had feedback that they don't like the fact that all the \"enum\"\ncontrol values (exposure modes, AWB modes, that kind of thing) are\nsimple integers up in the Python world. They complain that this makes\nthem quite unfriendly to use, and I'm inclined to agree! We could\nalways create Python-level definitions for them, and possibly add code\nto convert stuff on the fly, but I wonder if Pybind11 can do anything\nmore automatic for us?\n\nThanks!\nDavid\n\n>  Tomi\n>\n> Tomi Valkeinen (3):\n>   Add Python bindings\n>   py: add unittests.py\n>   py: Add cam.py\n>\n>  meson.build                  |   1 +\n>  meson_options.txt            |   5 +\n>  src/meson.build              |   1 +\n>  src/py/cam/cam.py            | 461 +++++++++++++++++++++++++++++++++++\n>  src/py/cam/cam_kms.py        | 183 ++++++++++++++\n>  src/py/cam/cam_null.py       |  46 ++++\n>  src/py/cam/cam_qt.py         | 355 +++++++++++++++++++++++++++\n>  src/py/cam/cam_qtgl.py       | 386 +++++++++++++++++++++++++++++\n>  src/py/cam/gl_helpers.py     |  67 +++++\n>  src/py/libcamera/__init__.py |  10 +\n>  src/py/libcamera/meson.build |  43 ++++\n>  src/py/libcamera/pyenums.cpp |  53 ++++\n>  src/py/libcamera/pymain.cpp  | 453 ++++++++++++++++++++++++++++++++++\n>  src/py/meson.build           |   1 +\n>  src/py/test/unittests.py     | 364 +++++++++++++++++++++++++++\n>  subprojects/.gitignore       |   3 +-\n>  subprojects/pybind11.wrap    |   6 +\n>  17 files changed, 2437 insertions(+), 1 deletion(-)\n>  create mode 100755 src/py/cam/cam.py\n>  create mode 100644 src/py/cam/cam_kms.py\n>  create mode 100644 src/py/cam/cam_null.py\n>  create mode 100644 src/py/cam/cam_qt.py\n>  create mode 100644 src/py/cam/cam_qtgl.py\n>  create mode 100644 src/py/cam/gl_helpers.py\n>  create mode 100644 src/py/libcamera/__init__.py\n>  create mode 100644 src/py/libcamera/meson.build\n>  create mode 100644 src/py/libcamera/pyenums.cpp\n>  create mode 100644 src/py/libcamera/pymain.cpp\n>  create mode 100644 src/py/meson.build\n>  create mode 100755 src/py/test/unittests.py\n>  create mode 100644 subprojects/pybind11.wrap\n>\n> --\n> 2.25.1\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 55578BDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Mar 2022 09:44:34 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 99EE9604E7;\n\tThu, 17 Mar 2022 10:44:33 +0100 (CET)","from mail-wm1-x331.google.com (mail-wm1-x331.google.com\n\t[IPv6:2a00:1450:4864:20::331])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 42525604DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 10:44:32 +0100 (CET)","by mail-wm1-x331.google.com with SMTP id p26so1618867wma.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 02:44:32 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647510273;\n\tbh=h97R+9Z/mHdQYVd5+NhrwaWoNTUB9GdM9dV1RYFm+jk=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=dbIQx3kGcEwoTlQKJAuXdiDpjo97DVTmKPajAlYPBX49hw3GnsBAR5qUfnRJ1IBr/\n\tiEnTegAUQ5cOEu71bllrzobBaWtPmBxIhuoKXxWk4/GnCUFLI/ln/y7su8nBtDwU2P\n\tqda0qrv6lV3QpJdZP6Rul+DbXQ38KhfykO1h2lkd1L3+koA54O2H5zrH9b1JwPjRbH\n\tzJh0a+OxERoFqjlCFMTqufkELKW+vOuGx2Kmptu6FZxs2IoGpEmkzevfmaDRtCb46a\n\tNAB6e41ZzRKNlmk2kuwYj58IH7tcxPHN7cEIBL1ithpWbfdBJJtMLj3hENb9jo30UA\n\tF+EEpuaEpOjTw==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=eLujtEIYwQd0OTEe8ZoUhFEyN0ZOmOCSWnTC0DCHh9Q=;\n\tb=rx5F+b3edjv1+PdmHh8Jbbn75BsdZwIcc6lAVH8a/U//gJE4ovfamkP3y4TcXzy9aY\n\t7fbJ+UOZLPqLeJwO1Ixj7c2XyNiX7TFVISs13rr+w3yJXCrbAbm8lsRepODuRE5MWKg0\n\tYvw7bXzrwoXaAUvJndlZFmALxnzf1GMT2agh9+vZdvnCckHWi5d60qDSy/ruI3LNti9m\n\tFx801BmVUouJfEhr+QbmwnsSClFH43dGKTIXYgSns7M7miIYvnHgdEORjcamPEeyJwv9\n\tR8Q08ytYRGzitetZU0avArSmP7Jjp6nhyRtqco629UDFctjxI9XnH0iixw6D9dfnrb8k\n\tuvVA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"rx5F+b3e\"; 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:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=eLujtEIYwQd0OTEe8ZoUhFEyN0ZOmOCSWnTC0DCHh9Q=;\n\tb=XabeNAx4gEtnQd5SG/QP4MrgSBBRV9jnzELXKb/39kLxRNQuy1weYauDs8ptgtTpwP\n\tFYLVwo35UYcs6TzL+C0zFd8gQ0EKyBxuL/THnsMs1DuNxsXAYqjOxjnsjZ8ErNysLVSh\n\tSeh2CoAXTC2GCLFwlNeHf+RnW3p6OCmVJGvOAnvR1tzycCUD6jB20GszXLyBjvePfl3I\n\t2d7gEEC5yvohLMvGdbkj1XXYVz9yD/Aive5/1kyOVasJE8Rg8wrqLWSwPQH+fIfKKQy1\n\tdO8DfTVMWQxP/FTuLV2Z/XaUdTmEwGmho9s4hPecJxnrUEumB5Id453FWGdO3wqLudPf\n\tLQUA==","X-Gm-Message-State":"AOAM531MXfuMs4OOfMeTjaqDImIee7yNGt1P60A/7Ma5tZvgKplFllwQ\n\tUxDZRCNx4tEd7xEYJunR3PhxIYXsBrP/UKwDG4ckjXZOEcIETQ==","X-Google-Smtp-Source":"ABdhPJzkRRXdMafYbYceiqyaTfYsxDM5bBHu3zmjfm8Xw/fR2RmUI3kcx1aJLLBzlxi4OOSUCPB4U6tv98jCL6zAG9M=","X-Received":"by 2002:a05:600c:5115:b0:389:bd64:85ab with SMTP id\n\to21-20020a05600c511500b00389bd6485abmr10857543wms.32.1647510271828;\n\tThu, 17 Mar 2022 02:44:31 -0700 (PDT)","MIME-Version":"1.0","References":"<20220314154633.506026-1-tomi.valkeinen@ideasonboard.com>","In-Reply-To":"<20220314154633.506026-1-tomi.valkeinen@ideasonboard.com>","Date":"Thu, 17 Mar 2022 09:44:20 +0000","Message-ID":"<CAHW6GYLW3rqbd-DHMxtFaqU_ad=-r7ZKzkPB_jxENrUWyO9viw@mail.gmail.com>","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22300,"web_url":"https://patchwork.libcamera.org/comment/22300/","msgid":"<34fdecb6-4a1e-740a-a318-ac1d8ea5f1e3@ideasonboard.com>","date":"2022-03-17T09:55:14","subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"On 17/03/2022 11:44, David Plowman wrote:\n> Hi everyone\n> \n> Thanks for the update!\n> \n> On Mon, 14 Mar 2022 at 15:46, Tomi Valkeinen\n> <tomi.valkeinen@ideasonboard.com> wrote:\n>>\n>> Hi,\n>>\n>> This is v5 of the series. The changes to v4:\n>>\n>> - Changed to pybind11 'smart_holders' branch which allows us to drop the\n>>    HACK for Camera public destructor\n>> - Changed Request.set_control() so that we can drop the HACK for\n>>    exposing Camera from Request\n>> - Moved Python enum defs to a separate file for clarity\n>> - \"Forward\" declare Python classes to fix docstring issues.\n>>\n>> The set_control change breaks the current users of that function.\n>> Previously you could do this:\n>>\n>> req.set_control(\"Brightness\", 1)\n>>\n>> Now you need to do:\n>>\n>> cid = camera.find_control(\"Brightness\")\n>> req.set_control(cid, 1)\n>>\n> \n> I see the need for this, and I guess it's fine - obviously we'll hide\n> that under our Picamera2 API as we wouldn't want our users to have to\n> do that!\n\nYes, it's not very nice. Then again, having to do a string search every \ntime we call set_control is not good either, at least if we can avoid it \n(and we can, as above). But I agree that in a higher level API things \nshould be easy. Of course, it would be nice to have both versions even \nin this low level API, but... if Request doesn't expose camera, I don't \nthink we can do it in a simple way.\n\n> There is one further thing I wanted to raise in relation to the Python\n> bindings for controls, now that a few folks are trying out Picamera2.\n> \n> I've had feedback that they don't like the fact that all the \"enum\"\n> control values (exposure modes, AWB modes, that kind of thing) are\n> simple integers up in the Python world. They complain that this makes\n> them quite unfriendly to use, and I'm inclined to agree! We could\n> always create Python-level definitions for them, and possibly add code\n> to convert stuff on the fly, but I wonder if Pybind11 can do anything\n> more automatic for us?\n\nCan you elaborate? Which enums are these?\n\n  Tomi","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 15784BDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Mar 2022 09:55:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 64E1B604E7;\n\tThu, 17 Mar 2022 10:55:19 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 48E6D604DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 10:55:18 +0100 (CET)","from [192.168.1.111] (91-156-85-209.elisa-laajakaista.fi\n\t[91.156.85.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9651A493;\n\tThu, 17 Mar 2022 10:55:17 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647510919;\n\tbh=cTrNz81PngJvFsMcd8qWjuKLZqMX+d013S9Y7YsXCbA=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=C2/IHRz/P7sdKkDmGgEJkjCxGM+gqStNf6AkVAialiiFlJ88vlC/1U4gJEPQF2Jff\n\tWRfh7Zk88Z1vVKsgOwDG3vkLCC34PVLlvpkDsKX8ipTGCvLspHSXdzBUziKdIfSCXG\n\tohYJKlw6vhg/JyHS3pQCK/WzgrYZ+DV5NnB5AWRBKUu7ELtSXZyM4ku3wqgi4H5mQx\n\tvjIaVefPpNKYIZEzoHG5qtrOrOFFuspXWVUE0Aa9J9xtS5ljm7paKNIyDRSdUNaYYE\n\tOTfaPTOgL57IwygQ3jwMYnKwa5ASXCsWZpTP+gPi1QJAOrj2whRmuMxI4xDCKevj3w\n\t52VLr2iBlM/qg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1647510917;\n\tbh=cTrNz81PngJvFsMcd8qWjuKLZqMX+d013S9Y7YsXCbA=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=Su9ELnUbSjfy+oFxOn1NlNbxhOKwEe9gbnYS9Wyg7OHvq/aeWucXRmd3rpivWqPOT\n\tsGrYJaTPRe0Dt509hTYg96J1TsRbW6rp73UzFhRz1Wr3eXCoTwVnb9YA4FaACssp5Y\n\tVDc/RRd4l+CjFJ+C+dJxpqydY2/6SlfWbaVat+mA="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Su9ELnUb\"; dkim-atps=neutral","Message-ID":"<34fdecb6-4a1e-740a-a318-ac1d8ea5f1e3@ideasonboard.com>","Date":"Thu, 17 Mar 2022 11:55:14 +0200","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.5.0","Content-Language":"en-US","To":"David Plowman <david.plowman@raspberrypi.com>","References":"<20220314154633.506026-1-tomi.valkeinen@ideasonboard.com>\n\t<CAHW6GYLW3rqbd-DHMxtFaqU_ad=-r7ZKzkPB_jxENrUWyO9viw@mail.gmail.com>","In-Reply-To":"<CAHW6GYLW3rqbd-DHMxtFaqU_ad=-r7ZKzkPB_jxENrUWyO9viw@mail.gmail.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","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":"Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22303,"web_url":"https://patchwork.libcamera.org/comment/22303/","msgid":"<029f59f0-50a0-0da2-eae3-ad97769f5556@ideasonboard.com>","date":"2022-03-17T10:03:25","subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"On 17/03/2022 11:55, Tomi Valkeinen wrote:\n> On 17/03/2022 11:44, David Plowman wrote:\n>> Hi everyone\n>>\n>> Thanks for the update!\n>>\n>> On Mon, 14 Mar 2022 at 15:46, Tomi Valkeinen\n>> <tomi.valkeinen@ideasonboard.com> wrote:\n>>>\n>>> Hi,\n>>>\n>>> This is v5 of the series. The changes to v4:\n>>>\n>>> - Changed to pybind11 'smart_holders' branch which allows us to drop the\n>>>    HACK for Camera public destructor\n>>> - Changed Request.set_control() so that we can drop the HACK for\n>>>    exposing Camera from Request\n>>> - Moved Python enum defs to a separate file for clarity\n>>> - \"Forward\" declare Python classes to fix docstring issues.\n>>>\n>>> The set_control change breaks the current users of that function.\n>>> Previously you could do this:\n>>>\n>>> req.set_control(\"Brightness\", 1)\n>>>\n>>> Now you need to do:\n>>>\n>>> cid = camera.find_control(\"Brightness\")\n>>> req.set_control(cid, 1)\n>>>\n>>\n>> I see the need for this, and I guess it's fine - obviously we'll hide\n>> that under our Picamera2 API as we wouldn't want our users to have to\n>> do that!\n\nI think the core question is whether a Request is tied to a Camera. I \nthought it is, as it is created from the Camera. And if that's the case, \nI don't see why the Camera cannot be exposed from the Request.\n\nMaybe Laurent can explain the reasons why not to expose it.\n\n> Yes, it's not very nice. Then again, having to do a string search every \n> time we call set_control is not good either, at least if we can avoid it \n> (and we can, as above). But I agree that in a higher level API things \n> should be easy. Of course, it would be nice to have both versions even \n> in this low level API, but... if Request doesn't expose camera, I don't \n> think we can do it in a simple way.\n\nNote that there are multiple ways to approach this. E.g.:\n\nreq.set_control(camera.controls[\"Brightness\"], 1)\n\nor:\n\nreq.set_control(camera.controls.Brightness, 1)\n\nor even (although this could perhaps conflict too easily):\n\nreq.set_control(camera.Brightness, 1)\n\nOr we could go the other way:\n\ncamera.set_control(req, \"Brightness\", 1)\n\nor:\n\ncamera.controls.Brightness.set(req, 1)\n\n  Tomi","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 57FE0BDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Mar 2022 10:03:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8AE0B604EA;\n\tThu, 17 Mar 2022 11:03:30 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D23A8604DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 11:03:28 +0100 (CET)","from [192.168.1.111] (91-156-85-209.elisa-laajakaista.fi\n\t[91.156.85.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3EDF4493;\n\tThu, 17 Mar 2022 11:03:28 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647511410;\n\tbh=vGOguu050MrFrpgAFqAzHJwyrpnuZF0irgLJnE1g2io=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=gh8X8fN3iNJfAY3Qd5njl/ap2QXHU/EoLoy5Zxt0mX47qRI+t9SsS1ZFWo28mH1tA\n\tCPih+XyZZRUdfvb4on6o9J53qkgwPAQlfjp4WbJBaEmDPtEc06EINTctjotmioVLJe\n\tN6cyolMML4HsTCUzOmLONTFJPRXbCvTAZ+taX9ufWcrpWtpys6y6cYeLC1VBzKZ4dl\n\t+ABax5z298IjxlBjyh/g8kluIf3zmloDNclXcSN8+L8ZUH3of7yXnD5fYtO/J9yYQ2\n\tvNebspsUJmWrgmgdJ6zuIq/tabTSnmJSDSk9g8m2ZEJzPabeq/CkF1RCHMp2PoEK5p\n\tCGgilN+zubnvg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1647511408;\n\tbh=vGOguu050MrFrpgAFqAzHJwyrpnuZF0irgLJnE1g2io=;\n\th=Date:Subject:From:To:Cc:References:In-Reply-To:From;\n\tb=e7THcMDT57gBzIKUqsev73qD24Re2AZC/UThYLOE8ArryTAazWfmZSgOf8t5/xb5s\n\tL46zMwLkUao6P2ZmYHIjBw65mvDRuK9ZGiPUQ37dl3Qh1Bc/RvbR0Kc0neJUHcPES0\n\tiiKkeh8jV5DxltorBuZOJngLFVPkqcwXZNds10R0="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"e7THcMDT\"; dkim-atps=neutral","Message-ID":"<029f59f0-50a0-0da2-eae3-ad97769f5556@ideasonboard.com>","Date":"Thu, 17 Mar 2022 12:03:25 +0200","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.5.0","Content-Language":"en-US","To":"David Plowman <david.plowman@raspberrypi.com>","References":"<20220314154633.506026-1-tomi.valkeinen@ideasonboard.com>\n\t<CAHW6GYLW3rqbd-DHMxtFaqU_ad=-r7ZKzkPB_jxENrUWyO9viw@mail.gmail.com>\n\t<34fdecb6-4a1e-740a-a318-ac1d8ea5f1e3@ideasonboard.com>","In-Reply-To":"<34fdecb6-4a1e-740a-a318-ac1d8ea5f1e3@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","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":"Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22304,"web_url":"https://patchwork.libcamera.org/comment/22304/","msgid":"<CAHW6GYLgLuctfjpTAAVhuQhXV0A2AE__qV1oWwa7Q-XJhf4JWg@mail.gmail.com>","date":"2022-03-17T10:06:35","subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"Hi Tomi\n\nOn Thu, 17 Mar 2022 at 10:03, Tomi Valkeinen\n<tomi.valkeinen@ideasonboard.com> wrote:\n>\n> On 17/03/2022 11:55, Tomi Valkeinen wrote:\n> > On 17/03/2022 11:44, David Plowman wrote:\n> >> Hi everyone\n> >>\n> >> Thanks for the update!\n> >>\n> >> On Mon, 14 Mar 2022 at 15:46, Tomi Valkeinen\n> >> <tomi.valkeinen@ideasonboard.com> wrote:\n> >>>\n> >>> Hi,\n> >>>\n> >>> This is v5 of the series. The changes to v4:\n> >>>\n> >>> - Changed to pybind11 'smart_holders' branch which allows us to drop the\n> >>>    HACK for Camera public destructor\n> >>> - Changed Request.set_control() so that we can drop the HACK for\n> >>>    exposing Camera from Request\n> >>> - Moved Python enum defs to a separate file for clarity\n> >>> - \"Forward\" declare Python classes to fix docstring issues.\n> >>>\n> >>> The set_control change breaks the current users of that function.\n> >>> Previously you could do this:\n> >>>\n> >>> req.set_control(\"Brightness\", 1)\n> >>>\n> >>> Now you need to do:\n> >>>\n> >>> cid = camera.find_control(\"Brightness\")\n> >>> req.set_control(cid, 1)\n> >>>\n> >>\n> >> I see the need for this, and I guess it's fine - obviously we'll hide\n> >> that under our Picamera2 API as we wouldn't want our users to have to\n> >> do that!\n>\n> I think the core question is whether a Request is tied to a Camera. I\n> thought it is, as it is created from the Camera. And if that's the case,\n> I don't see why the Camera cannot be exposed from the Request.\n>\n> Maybe Laurent can explain the reasons why not to expose it.\n\nI wouldn't want to worry too much about this! I'll just hide it under\nthe Picamera2 API and that's fine...\n\nDavid\n\n>\n> > Yes, it's not very nice. Then again, having to do a string search every\n> > time we call set_control is not good either, at least if we can avoid it\n> > (and we can, as above). But I agree that in a higher level API things\n> > should be easy. Of course, it would be nice to have both versions even\n> > in this low level API, but... if Request doesn't expose camera, I don't\n> > think we can do it in a simple way.\n>\n> Note that there are multiple ways to approach this. E.g.:\n>\n> req.set_control(camera.controls[\"Brightness\"], 1)\n>\n> or:\n>\n> req.set_control(camera.controls.Brightness, 1)\n>\n> or even (although this could perhaps conflict too easily):\n>\n> req.set_control(camera.Brightness, 1)\n>\n> Or we could go the other way:\n>\n> camera.set_control(req, \"Brightness\", 1)\n>\n> or:\n>\n> camera.controls.Brightness.set(req, 1)\n>\n>   Tomi","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 44F2EBDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Mar 2022 10:06:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8F65F604E7;\n\tThu, 17 Mar 2022 11:06:48 +0100 (CET)","from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com\n\t[IPv6:2a00:1450:4864:20::42a])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0F988604DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 11:06:47 +0100 (CET)","by mail-wr1-x42a.google.com with SMTP id r6so6614214wrr.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 03:06:47 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647511608;\n\tbh=lORLfL/ZYBq3mIDa9IUByYgND0iS3hE6s6AXCZPZcxI=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=F5zLaVEh08qOFtqaMqyfnELOoEfSi+4cnXaTdIsclD+FG9DtwMdaeGulN9bIW3RWR\n\tUgmP1ZLaxmRQsiebzPeGwUeJgQST1Jn6Wq3KvSCfzM7cTKNauPRCcQqpF5U93+Vp6y\n\tdelSK83tdy7k7pEq0Jj3CYxBamW/EPwNAj8KsL8vCz+5SK9VZ+zHCgTLFyXkrLJh2Y\n\tqOZMZmiqFHhwLpTp/W9chJZqM0Ht9WzWRAZ6hCs98OpurJXpibLtX/xBxgmxwq9jSO\n\t3KA86n4+wSm+FAmXnlQdGkvMhX5ANAcX7VfDRCHnxORuV2BpN668XwaZVd0Bnlv4ek\n\tMtfg0fQ1yk9Ag==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=9EcYwHw30sAoI3etEl4BtK9vQ3V9M5wQHU+MJevyvt8=;\n\tb=kAAfe+RIrWiKKUl/fIEoE+U41XcFxEQThb7y9f7W/5YLBhERXWqdYPKdwX7qdnQKzb\n\tw0Za/rq9kopU1xEyLKz+69QHZe9/OfSRgSxGW01wmSOEfhDKEWKqS9xnpa/Tp+f9iHt/\n\tu4IDX6QrLE7WcqLrej4n5a4GeWHDugOJCmOvyTb1s1rIsn5st0jR6XtSOWmTBjBG3bDz\n\t76x/xxL4hzX5GOD9KWy0B66xvcA3CtUpQTx/yMZX1da0Xpmdx6LCLiirT6pumhH3hNG9\n\tr1qch47xeFNXx0Q4vxaQXWfuJI1jbXtkxj6DfFx9ZDtTlYY5MMIQKxC8pmYZB2jFxPiT\n\tcz4Q=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"kAAfe+RI\"; 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:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=9EcYwHw30sAoI3etEl4BtK9vQ3V9M5wQHU+MJevyvt8=;\n\tb=QU6u3E77L2EvLqbPSsijut+XJISiFhWTP6lAfOWqIQmWrlTFZ+yJPT4620QxgKygvB\n\tLlVLIbBRXLxo4bXHNE6DFuxrJP3eA8fDqUG8Z9gu2JF6d8Ivdph9Ylt8lxXPQ9WApkkw\n\t9FoECp9kX7qUwASpV4qaAZEtHxb38FvoQS+i3TL4bYRgxIUJ6FKE1t6a96VFM55laOsf\n\tW+GNbpTpSP2fx0+MxTlr7t9NckvUZ6mp00QxomiZ8V6vZ64fT2gv8rBfJQofEtJx1mhY\n\tIaUWwlzjO6PGOA9M9Dg+0KZCnaHyd72fNpMDAAJqpo3e1VTjbmLeEwEPKswE8cTV5yg/\n\teDTQ==","X-Gm-Message-State":"AOAM5338kHFP52NGX1zuKLjmz1H01wMMl+VJB8nkMqhFQcbwcuQeNUdO\n\ttW4/Q2lfDUX6huyQXxg5ZbZr3Nk7JTOmgs4zTGPs7A==","X-Google-Smtp-Source":"ABdhPJx6CJ0tv4yLz67+05UxdhCpVNbgJjEZR7Q1XsbeBPEVEK8o7YPJ4jPqo5uaKLjF9SDva+KNZxtGzdj3BgpG1TI=","X-Received":"by 2002:adf:f04b:0:b0:203:f0bf:1d83 with SMTP id\n\tt11-20020adff04b000000b00203f0bf1d83mr269784wro.317.1647511606610;\n\tThu, 17 Mar 2022 03:06:46 -0700 (PDT)","MIME-Version":"1.0","References":"<20220314154633.506026-1-tomi.valkeinen@ideasonboard.com>\n\t<CAHW6GYLW3rqbd-DHMxtFaqU_ad=-r7ZKzkPB_jxENrUWyO9viw@mail.gmail.com>\n\t<34fdecb6-4a1e-740a-a318-ac1d8ea5f1e3@ideasonboard.com>\n\t<029f59f0-50a0-0da2-eae3-ad97769f5556@ideasonboard.com>","In-Reply-To":"<029f59f0-50a0-0da2-eae3-ad97769f5556@ideasonboard.com>","Date":"Thu, 17 Mar 2022 10:06:35 +0000","Message-ID":"<CAHW6GYLgLuctfjpTAAVhuQhXV0A2AE__qV1oWwa7Q-XJhf4JWg@mail.gmail.com>","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22305,"web_url":"https://patchwork.libcamera.org/comment/22305/","msgid":"<CAHW6GY+PAV_9P4ikPv3mdFCNLNQTbmhgcBe=+d_SK4R9Z7=1Vg@mail.gmail.com>","date":"2022-03-17T10:12:12","subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"Hi again\n\nJust to answer the about about the \"enum\" type controls:\n\nOn Thu, 17 Mar 2022 at 09:55, Tomi Valkeinen\n<tomi.valkeinen@ideasonboard.com> wrote:\n>\n> On 17/03/2022 11:44, David Plowman wrote:\n> > Hi everyone\n> >\n> > Thanks for the update!\n> >\n> > On Mon, 14 Mar 2022 at 15:46, Tomi Valkeinen\n> > <tomi.valkeinen@ideasonboard.com> wrote:\n> >>\n> >> Hi,\n> >>\n> >> This is v5 of the series. The changes to v4:\n> >>\n> >> - Changed to pybind11 'smart_holders' branch which allows us to drop the\n> >>    HACK for Camera public destructor\n> >> - Changed Request.set_control() so that we can drop the HACK for\n> >>    exposing Camera from Request\n> >> - Moved Python enum defs to a separate file for clarity\n> >> - \"Forward\" declare Python classes to fix docstring issues.\n> >>\n> >> The set_control change breaks the current users of that function.\n> >> Previously you could do this:\n> >>\n> >> req.set_control(\"Brightness\", 1)\n> >>\n> >> Now you need to do:\n> >>\n> >> cid = camera.find_control(\"Brightness\")\n> >> req.set_control(cid, 1)\n> >>\n> >\n> > I see the need for this, and I guess it's fine - obviously we'll hide\n> > that under our Picamera2 API as we wouldn't want our users to have to\n> > do that!\n>\n> Yes, it's not very nice. Then again, having to do a string search every\n> time we call set_control is not good either, at least if we can avoid it\n> (and we can, as above). But I agree that in a higher level API things\n> should be easy. Of course, it would be nice to have both versions even\n> in this low level API, but... if Request doesn't expose camera, I don't\n> think we can do it in a simple way.\n>\n> > There is one further thing I wanted to raise in relation to the Python\n> > bindings for controls, now that a few folks are trying out Picamera2.\n> >\n> > I've had feedback that they don't like the fact that all the \"enum\"\n> > control values (exposure modes, AWB modes, that kind of thing) are\n> > simple integers up in the Python world. They complain that this makes\n> > them quite unfriendly to use, and I'm inclined to agree! We could\n> > always create Python-level definitions for them, and possibly add code\n> > to convert stuff on the fly, but I wonder if Pybind11 can do anything\n> > more automatic for us?\n>\n> Can you elaborate? Which enums are these?\n\nSo users would prefer to write something like\n\npicamera2.set_controls({\"AwbMode\": AwbMode.Indoor})\n\nrather than\n\npicamera2.set_controls({\"AwbMode\": 4})\n\nThe same applies to all the controls of this type, there including\n\nAeMeteringMode\nAeConstraintMode\nAeExposureMode\nAwbMode\nNoiseReductionMode\nthere will at some point be an AfMode and probably other AF ones\nand so on.\n\nBasically it looks to be mostly anything with \"Mode\" on the end,\nthough I think we will encounter some others too. Also anything with\n\"State\" on the end is probably similar, though in this case we're\ntalking about reported values, not ones you can set.\n\nDoes that make sense?\n\nThanks!\nDavid\n\n>\n>   Tomi","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 7BD9CBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Mar 2022 10:12:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C2F33604E7;\n\tThu, 17 Mar 2022 11:12:24 +0100 (CET)","from mail-wr1-x435.google.com (mail-wr1-x435.google.com\n\t[IPv6:2a00:1450:4864:20::435])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E44D8604DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 11:12:23 +0100 (CET)","by mail-wr1-x435.google.com with SMTP id d7so6617935wrb.7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 03:12:23 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647511944;\n\tbh=r3FTtzOFWlizYX/Mlkj1p7WlCAXE7vDmDmZYOsbDits=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=pTwifXeI3GlgU7J7Y17/3e8iagCZ57OlTKJ5/RSKIvUYdt9t6gpEIHEstr7C1n243\n\tipjjqz4YGiDTIMY2ym1ECkdyO8uHy2g96diziF36EVthYp5mVbmURXqAOQ83/ZH8RL\n\tA4KSInoYlg1ODdri9C8krH7mEMx32ZHimCUUWndRsGFew9mtpXwPOvs1RVNMJO2BfA\n\tGB6a54OFJV43Xe3l6wOkHQu3y7zfoaafI1GMfxxSH17241QrPaKHO/pxCXpONMKr1h\n\tE0DBjBvWZbvuNuTtcXW7Sn8avo3XLMq+axMaMWdycYROBQPnsG+B2QrbSzGoUGBs4g\n\taCczw+ybZEkkg==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=zrNDNwQcyJbKMmoWySf7EGQ2Frf87+QYM3fA/C9C6e8=;\n\tb=QfYXnRQwul6M9W8fHf9b+HFJveFJf3UmSXgnQ1EmCpOkJhpxkEToZ2IH3Ki72UOHeO\n\tGsWWzzKviKlyx+/4YV4csJh5mAyuPcEz4BGWnuJOWLovYQvujXn9foHwftKfYz23YPUm\n\t58mxc0cANamv6o+fV8jAaJPFpTaaDtDv3sn6OM4Cn3B88Ni5mwEGpnemij/ukOrH9BYB\n\tFG78ooTsN7JosMkCx5HwPPnElGqNrilXAHwNSjkrU1t2cu6SWmmj6UzSpSwDiPulb0r7\n\tOfdpygSmdSGtbxNc7EYIFnKVy3dZchjQRwzxWt5ksJCpZ/CsC3NPv2B0x4/Xf2hELisa\n\tHD5w=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"QfYXnRQw\"; 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:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=zrNDNwQcyJbKMmoWySf7EGQ2Frf87+QYM3fA/C9C6e8=;\n\tb=HOuQQOHEXMiLgSSEFONZeYiD9tiqKBhFe58+Vgsx3+nB+RqxaMjooRFz6YuO7P7zOq\n\t2jjqbyxClb3Lxc88ZjJMRzfXFF7xMStCCgjEvYPBUWcZkW/AiWtntMjcKvkCCIev7pyL\n\tCHCSzRjy6/O4Q2DlIrOjUIpaj31hjQAxjhxS6CBQLET07ZQ4LHpB7C2sa5hfpJB7y766\n\tmTyM2J5xylAQZOISh67fSQFAeqi/XtrpuapDH06bTFzeNj22tZnBCoyZbJIBSTn03Dw/\n\tusOoEFxbaO0AUaJQIF3CQLDLEGEsA0TssvG9LqIFJqDA4uxjTWigvMp79na3wPNFpkF0\n\tb9dw==","X-Gm-Message-State":"AOAM533FQwMqx4+49E7kvtQH5SIhCj6Q1KxFl8KASuFe0n3sm8WNEPYP\n\tIfbHAqG6UDCPdlgpLgcRD2yJtFlEqoyXQdYqLBcoMA==","X-Google-Smtp-Source":"ABdhPJyoB0FS6ri1eEQ7UCVT/+UFZvYuYwQ1g+uw8h5gzYD/hcpO8hUYQcMwqJYalOwsbp9oJIerGHqr1ejoBUZiAdE=","X-Received":"by 2002:adf:f04b:0:b0:203:f0bf:1d83 with SMTP id\n\tt11-20020adff04b000000b00203f0bf1d83mr292719wro.317.1647511943487;\n\tThu, 17 Mar 2022 03:12:23 -0700 (PDT)","MIME-Version":"1.0","References":"<20220314154633.506026-1-tomi.valkeinen@ideasonboard.com>\n\t<CAHW6GYLW3rqbd-DHMxtFaqU_ad=-r7ZKzkPB_jxENrUWyO9viw@mail.gmail.com>\n\t<34fdecb6-4a1e-740a-a318-ac1d8ea5f1e3@ideasonboard.com>","In-Reply-To":"<34fdecb6-4a1e-740a-a318-ac1d8ea5f1e3@ideasonboard.com>","Date":"Thu, 17 Mar 2022 10:12:12 +0000","Message-ID":"<CAHW6GY+PAV_9P4ikPv3mdFCNLNQTbmhgcBe=+d_SK4R9Z7=1Vg@mail.gmail.com>","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22308,"web_url":"https://patchwork.libcamera.org/comment/22308/","msgid":"<13f598d1-98e0-4830-cc9f-5e56ee932c07@ideasonboard.com>","date":"2022-03-17T10:41:25","subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"On 17/03/2022 12:12, David Plowman wrote:\n> Hi again\n> \n> Just to answer the about about the \"enum\" type controls:\n> \n> On Thu, 17 Mar 2022 at 09:55, Tomi Valkeinen\n> <tomi.valkeinen@ideasonboard.com> wrote:\n>>\n>> On 17/03/2022 11:44, David Plowman wrote:\n>>> Hi everyone\n>>>\n>>> Thanks for the update!\n>>>\n>>> On Mon, 14 Mar 2022 at 15:46, Tomi Valkeinen\n>>> <tomi.valkeinen@ideasonboard.com> wrote:\n>>>>\n>>>> Hi,\n>>>>\n>>>> This is v5 of the series. The changes to v4:\n>>>>\n>>>> - Changed to pybind11 'smart_holders' branch which allows us to drop the\n>>>>     HACK for Camera public destructor\n>>>> - Changed Request.set_control() so that we can drop the HACK for\n>>>>     exposing Camera from Request\n>>>> - Moved Python enum defs to a separate file for clarity\n>>>> - \"Forward\" declare Python classes to fix docstring issues.\n>>>>\n>>>> The set_control change breaks the current users of that function.\n>>>> Previously you could do this:\n>>>>\n>>>> req.set_control(\"Brightness\", 1)\n>>>>\n>>>> Now you need to do:\n>>>>\n>>>> cid = camera.find_control(\"Brightness\")\n>>>> req.set_control(cid, 1)\n>>>>\n>>>\n>>> I see the need for this, and I guess it's fine - obviously we'll hide\n>>> that under our Picamera2 API as we wouldn't want our users to have to\n>>> do that!\n>>\n>> Yes, it's not very nice. Then again, having to do a string search every\n>> time we call set_control is not good either, at least if we can avoid it\n>> (and we can, as above). But I agree that in a higher level API things\n>> should be easy. Of course, it would be nice to have both versions even\n>> in this low level API, but... if Request doesn't expose camera, I don't\n>> think we can do it in a simple way.\n>>\n>>> There is one further thing I wanted to raise in relation to the Python\n>>> bindings for controls, now that a few folks are trying out Picamera2.\n>>>\n>>> I've had feedback that they don't like the fact that all the \"enum\"\n>>> control values (exposure modes, AWB modes, that kind of thing) are\n>>> simple integers up in the Python world. They complain that this makes\n>>> them quite unfriendly to use, and I'm inclined to agree! We could\n>>> always create Python-level definitions for them, and possibly add code\n>>> to convert stuff on the fly, but I wonder if Pybind11 can do anything\n>>> more automatic for us?\n>>\n>> Can you elaborate? Which enums are these?\n> \n> So users would prefer to write something like\n> \n> picamera2.set_controls({\"AwbMode\": AwbMode.Indoor})\n> \n> rather than\n> \n> picamera2.set_controls({\"AwbMode\": 4})\n> \n> The same applies to all the controls of this type, there including\n> \n> AeMeteringMode\n> AeConstraintMode\n> AeExposureMode\n> AwbMode\n> NoiseReductionMode\n> there will at some point be an AfMode and probably other AF ones\n> and so on.\n> \n> Basically it looks to be mostly anything with \"Mode\" on the end,\n> though I think we will encounter some others too. Also anything with\n> \"State\" on the end is probably similar, though in this case we're\n> talking about reported values, not ones you can set.\n\nLooks like these are defined in src/libcamera/control_ids.yaml, so we \ncould have a script that generates pybind11 code to create the enums. Or \nwe could just do it by hand.\n\nIs that your question, how and where to define the python enums? Or do \nyou think there's some issue using those?\n\n  Tomi","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 C1904BDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Mar 2022 10:41:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 18FBA604E7;\n\tThu, 17 Mar 2022 11:41:32 +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 6EDCD604DB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 11:41:30 +0100 (CET)","from [192.168.1.111] (91-156-85-209.elisa-laajakaista.fi\n\t[91.156.85.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BC8B0493;\n\tThu, 17 Mar 2022 11:41:29 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647513692;\n\tbh=Zd8bTkSTZenm8nboEGx9QM7Ds7z/6rZtVVAxQgxETis=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=EVYoelmOWGH9XZ7UkP7VDhZz7nAWOHAG10gK7ZXpbWXSGLDP9REBn6DumGuQ7LCBI\n\tL5WHCFf+9tb9Er5Wlty/xoP8FO/QYgBmw61jyZUUqqEWAW9aZpXGI+oIF82Gu88GbX\n\ttQy90HSxETkZLSOzT+5G3QZiaXpIXPyBjSHz2xseb8imxVFFS6RDBwF7BHdOzJPM9j\n\t06/l1vK9zORoQ+xdtA6ruu9pUPDYWUB6ZHieVUyZBlvNqAT3N6t04Rh3lhLjf128Bq\n\tAunW3zRr9EBUAjkh3L6qXWJFAxay4RijS57FaAHTaHzyuFiQspJjIXjtAEZ85RCzHe\n\tCzhqy2yVVQImg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1647513690;\n\tbh=Zd8bTkSTZenm8nboEGx9QM7Ds7z/6rZtVVAxQgxETis=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=ivanPSf24L3aCVTXygSHwIvWjE51oD5AJC+y4yBc0vk+jK2Rq1uwKJpVTZiDlEP1P\n\t5J7wlSMQEybVXgNF8jWRhKyEOnD2wbJOT02npyenXa7WJmm7az2i4KY2d7OzoonYN6\n\tKAiBxOi7RCtIM8bO7HtUwyZXSOnJFYkwa4KxXt7w="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ivanPSf2\"; dkim-atps=neutral","Message-ID":"<13f598d1-98e0-4830-cc9f-5e56ee932c07@ideasonboard.com>","Date":"Thu, 17 Mar 2022 12:41:25 +0200","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.5.0","Content-Language":"en-US","To":"David Plowman <david.plowman@raspberrypi.com>","References":"<20220314154633.506026-1-tomi.valkeinen@ideasonboard.com>\n\t<CAHW6GYLW3rqbd-DHMxtFaqU_ad=-r7ZKzkPB_jxENrUWyO9viw@mail.gmail.com>\n\t<34fdecb6-4a1e-740a-a318-ac1d8ea5f1e3@ideasonboard.com>\n\t<CAHW6GY+PAV_9P4ikPv3mdFCNLNQTbmhgcBe=+d_SK4R9Z7=1Vg@mail.gmail.com>","In-Reply-To":"<CAHW6GY+PAV_9P4ikPv3mdFCNLNQTbmhgcBe=+d_SK4R9Z7=1Vg@mail.gmail.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","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":"Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22309,"web_url":"https://patchwork.libcamera.org/comment/22309/","msgid":"<CAHW6GYK_CeB35PCqduBOma1-rMiYj8-NejM21Sc6vJZ8CXi_vw@mail.gmail.com>","date":"2022-03-17T11:01:12","subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"Hi again\n\nOn Thu, 17 Mar 2022 at 10:41, Tomi Valkeinen\n<tomi.valkeinen@ideasonboard.com> wrote:\n>\n> On 17/03/2022 12:12, David Plowman wrote:\n> > Hi again\n> >\n> > Just to answer the about about the \"enum\" type controls:\n> >\n> > On Thu, 17 Mar 2022 at 09:55, Tomi Valkeinen\n> > <tomi.valkeinen@ideasonboard.com> wrote:\n> >>\n> >> On 17/03/2022 11:44, David Plowman wrote:\n> >>> Hi everyone\n> >>>\n> >>> Thanks for the update!\n> >>>\n> >>> On Mon, 14 Mar 2022 at 15:46, Tomi Valkeinen\n> >>> <tomi.valkeinen@ideasonboard.com> wrote:\n> >>>>\n> >>>> Hi,\n> >>>>\n> >>>> This is v5 of the series. The changes to v4:\n> >>>>\n> >>>> - Changed to pybind11 'smart_holders' branch which allows us to drop the\n> >>>>     HACK for Camera public destructor\n> >>>> - Changed Request.set_control() so that we can drop the HACK for\n> >>>>     exposing Camera from Request\n> >>>> - Moved Python enum defs to a separate file for clarity\n> >>>> - \"Forward\" declare Python classes to fix docstring issues.\n> >>>>\n> >>>> The set_control change breaks the current users of that function.\n> >>>> Previously you could do this:\n> >>>>\n> >>>> req.set_control(\"Brightness\", 1)\n> >>>>\n> >>>> Now you need to do:\n> >>>>\n> >>>> cid = camera.find_control(\"Brightness\")\n> >>>> req.set_control(cid, 1)\n> >>>>\n> >>>\n> >>> I see the need for this, and I guess it's fine - obviously we'll hide\n> >>> that under our Picamera2 API as we wouldn't want our users to have to\n> >>> do that!\n> >>\n> >> Yes, it's not very nice. Then again, having to do a string search every\n> >> time we call set_control is not good either, at least if we can avoid it\n> >> (and we can, as above). But I agree that in a higher level API things\n> >> should be easy. Of course, it would be nice to have both versions even\n> >> in this low level API, but... if Request doesn't expose camera, I don't\n> >> think we can do it in a simple way.\n> >>\n> >>> There is one further thing I wanted to raise in relation to the Python\n> >>> bindings for controls, now that a few folks are trying out Picamera2.\n> >>>\n> >>> I've had feedback that they don't like the fact that all the \"enum\"\n> >>> control values (exposure modes, AWB modes, that kind of thing) are\n> >>> simple integers up in the Python world. They complain that this makes\n> >>> them quite unfriendly to use, and I'm inclined to agree! We could\n> >>> always create Python-level definitions for them, and possibly add code\n> >>> to convert stuff on the fly, but I wonder if Pybind11 can do anything\n> >>> more automatic for us?\n> >>\n> >> Can you elaborate? Which enums are these?\n> >\n> > So users would prefer to write something like\n> >\n> > picamera2.set_controls({\"AwbMode\": AwbMode.Indoor})\n> >\n> > rather than\n> >\n> > picamera2.set_controls({\"AwbMode\": 4})\n> >\n> > The same applies to all the controls of this type, there including\n> >\n> > AeMeteringMode\n> > AeConstraintMode\n> > AeExposureMode\n> > AwbMode\n> > NoiseReductionMode\n> > there will at some point be an AfMode and probably other AF ones\n> > and so on.\n> >\n> > Basically it looks to be mostly anything with \"Mode\" on the end,\n> > though I think we will encounter some others too. Also anything with\n> > \"State\" on the end is probably similar, though in this case we're\n> > talking about reported values, not ones you can set.\n>\n> Looks like these are defined in src/libcamera/control_ids.yaml, so we\n> could have a script that generates pybind11 code to create the enums. Or\n> we could just do it by hand.\n\nDefining them by hand is fine with me, at least for the time being. I\njust wonder whether it would get annoying in the longer run, so some\nkind of script in the build system might be helpful.\n\n>\n> Is that your question, how and where to define the python enums? Or do\n> you think there's some issue using those?\n\nI don't think there's any problem, I guess I'm just flagging that\nthere's something we probably need to do. I could define them all in\nPicamera2, but it seems like everyone using these Python bindings\nwould appreciate them, so they probably belong in libcamera somewhere.\n\nThanks!\nDavid\n\n>\n>   Tomi","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 A2C1EBDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Mar 2022 11:01:25 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4A5F3604DC;\n\tThu, 17 Mar 2022 12:01:25 +0100 (CET)","from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com\n\t[IPv6:2a00:1450:4864:20::32c])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id EBB69601F8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 12:01:23 +0100 (CET)","by mail-wm1-x32c.google.com with SMTP id r7so2888372wmq.2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 04:01:23 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647514885;\n\tbh=iAiVP7+Qc/WhvDbVS+Z1U2eeYa6829EZEa420LVjGDk=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=g6s+zmkKl2qrwhNHXO3r3ZaWlJFVJoehZJIQN+/2fTkEx33qsWEgMtrjVf7zjsNL7\n\tQghTcu36Z5K0nmQFc/k0R9o9PqqGtUJU9HpIHmokrzXAVUhMHPkv6YYgpexl/UlA/8\n\tocXhw0A/MYpTLlGdpFRCFV8ouEGPIMif91i4e2kZbkHPCag73JgwICloSaOlCtBxX4\n\t9evppT1lTVKlgt5FRAsuQa+EEPFp7WwUMqVkQbKUaVllWkcKjDlgJePrVtIKUpwp+I\n\tD6iN99GBIW9l1I9zNn4cw+jGo8JKRvLRttXwkcQy/ObxXPaTTm8j3DRO4HwUp9BRTk\n\tsnDqovbuuxxYw==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=5JsUiaItN1uuHjNYYCFZj3fRwRfDKkEq/jV5J0tpfmU=;\n\tb=pIgEBLtE0+JWlqmqn5tx6cqek1vnKSS3r1x7J0OCLem8t1j/njM474KDOeq5apSceQ\n\tPFiSsG6LUpR+Pe/p7Mi6dH9X3lruuhsvHN2gO60gPSdPeai2QtnSCxu2mznTrbaMszpX\n\tmu4cb9eHxej+pVQuXn2L62jMo4xQoy9FPuiV67QUEsjkNIx69zqBkMLYbbrEwa7VipGY\n\tJnZV/CaZMjwEYmo1a3gr2fYxvEykIa6VYJfp9lbIp/HiAKBJyHNlpjljODSoSXjlwgTB\n\t7B6CljTVeCEEmoDfLn2lvgHJmcR2n+Isl6xv5gqnlSlW7jVezT4NnGmhzP5F6mBH7UjC\n\tchFA=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"pIgEBLtE\"; 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:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=5JsUiaItN1uuHjNYYCFZj3fRwRfDKkEq/jV5J0tpfmU=;\n\tb=bgLebbEWK+Kr9oFUWS1YYYHlMj3WTRRGz18EoFRTD3OYKOegRQOxqHk/oYkt5XfpUp\n\twdjRN9iSlQDdYXf5tJh1o9x7ZZHcPbgNv8/hHGW9w5njwI8mQFuh8Ip2h2yKsKPXawTD\n\thaYC1UpvP9ZVRfdgm7oCB1mOgEgSUoik/DLAmNxz2TW+vN4sqVHTKzBc9alm38fB/NcI\n\txaTOhqfw8anOB8d5ENxMy3Bh7XIJTnKir26c/r1kk0uVRF4iMT+mTcQHwvtFpdeH+eLs\n\tZNeU/LRQQGPMPXCh4ExxbJtcw0iZQE0s7kRVaR3vPTCDI/SfEBmpfsNS+hP/Kb+iu8TO\n\tQTIw==","X-Gm-Message-State":"AOAM533idNbBdN0qzy2QOk753+qCsL46Ewi4R/iXfSCq+Jx/VN8Rh/1/\n\tzoONzDHf46YURPJrD0cD9B/edFlxmBXESq5iBPhXfg==","X-Google-Smtp-Source":"ABdhPJz1qU0777sR6yS6GRIgfPO+kKB5hYOBRFs/nJLHB/GUYbSKV7GOZlYsvC5j0ZxCYVxNLR8y7CKcfcnwO/2ZhqQ=","X-Received":"by 2002:a05:600c:2249:b0:38c:8232:3004 with SMTP id\n\ta9-20020a05600c224900b0038c82323004mr781181wmm.164.1647514883543;\n\tThu, 17 Mar 2022 04:01:23 -0700 (PDT)","MIME-Version":"1.0","References":"<20220314154633.506026-1-tomi.valkeinen@ideasonboard.com>\n\t<CAHW6GYLW3rqbd-DHMxtFaqU_ad=-r7ZKzkPB_jxENrUWyO9viw@mail.gmail.com>\n\t<34fdecb6-4a1e-740a-a318-ac1d8ea5f1e3@ideasonboard.com>\n\t<CAHW6GY+PAV_9P4ikPv3mdFCNLNQTbmhgcBe=+d_SK4R9Z7=1Vg@mail.gmail.com>\n\t<13f598d1-98e0-4830-cc9f-5e56ee932c07@ideasonboard.com>","In-Reply-To":"<13f598d1-98e0-4830-cc9f-5e56ee932c07@ideasonboard.com>","Date":"Thu, 17 Mar 2022 11:01:12 +0000","Message-ID":"<CAHW6GYK_CeB35PCqduBOma1-rMiYj8-NejM21Sc6vJZ8CXi_vw@mail.gmail.com>","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22315,"web_url":"https://patchwork.libcamera.org/comment/22315/","msgid":"<183934ca-36d6-e8f2-11fe-d580e03630f8@ideasonboard.com>","date":"2022-03-17T11:36:21","subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"On 17/03/2022 13:01, David Plowman wrote:\n> Hi again\n> \n> On Thu, 17 Mar 2022 at 10:41, Tomi Valkeinen\n> <tomi.valkeinen@ideasonboard.com> wrote:\n>>\n>> On 17/03/2022 12:12, David Plowman wrote:\n>>> Hi again\n>>>\n>>> Just to answer the about about the \"enum\" type controls:\n>>>\n>>> On Thu, 17 Mar 2022 at 09:55, Tomi Valkeinen\n>>> <tomi.valkeinen@ideasonboard.com> wrote:\n>>>>\n>>>> On 17/03/2022 11:44, David Plowman wrote:\n>>>>> Hi everyone\n>>>>>\n>>>>> Thanks for the update!\n>>>>>\n>>>>> On Mon, 14 Mar 2022 at 15:46, Tomi Valkeinen\n>>>>> <tomi.valkeinen@ideasonboard.com> wrote:\n>>>>>>\n>>>>>> Hi,\n>>>>>>\n>>>>>> This is v5 of the series. The changes to v4:\n>>>>>>\n>>>>>> - Changed to pybind11 'smart_holders' branch which allows us to drop the\n>>>>>>      HACK for Camera public destructor\n>>>>>> - Changed Request.set_control() so that we can drop the HACK for\n>>>>>>      exposing Camera from Request\n>>>>>> - Moved Python enum defs to a separate file for clarity\n>>>>>> - \"Forward\" declare Python classes to fix docstring issues.\n>>>>>>\n>>>>>> The set_control change breaks the current users of that function.\n>>>>>> Previously you could do this:\n>>>>>>\n>>>>>> req.set_control(\"Brightness\", 1)\n>>>>>>\n>>>>>> Now you need to do:\n>>>>>>\n>>>>>> cid = camera.find_control(\"Brightness\")\n>>>>>> req.set_control(cid, 1)\n>>>>>>\n>>>>>\n>>>>> I see the need for this, and I guess it's fine - obviously we'll hide\n>>>>> that under our Picamera2 API as we wouldn't want our users to have to\n>>>>> do that!\n>>>>\n>>>> Yes, it's not very nice. Then again, having to do a string search every\n>>>> time we call set_control is not good either, at least if we can avoid it\n>>>> (and we can, as above). But I agree that in a higher level API things\n>>>> should be easy. Of course, it would be nice to have both versions even\n>>>> in this low level API, but... if Request doesn't expose camera, I don't\n>>>> think we can do it in a simple way.\n>>>>\n>>>>> There is one further thing I wanted to raise in relation to the Python\n>>>>> bindings for controls, now that a few folks are trying out Picamera2.\n>>>>>\n>>>>> I've had feedback that they don't like the fact that all the \"enum\"\n>>>>> control values (exposure modes, AWB modes, that kind of thing) are\n>>>>> simple integers up in the Python world. They complain that this makes\n>>>>> them quite unfriendly to use, and I'm inclined to agree! We could\n>>>>> always create Python-level definitions for them, and possibly add code\n>>>>> to convert stuff on the fly, but I wonder if Pybind11 can do anything\n>>>>> more automatic for us?\n>>>>\n>>>> Can you elaborate? Which enums are these?\n>>>\n>>> So users would prefer to write something like\n>>>\n>>> picamera2.set_controls({\"AwbMode\": AwbMode.Indoor})\n>>>\n>>> rather than\n>>>\n>>> picamera2.set_controls({\"AwbMode\": 4})\n>>>\n>>> The same applies to all the controls of this type, there including\n>>>\n>>> AeMeteringMode\n>>> AeConstraintMode\n>>> AeExposureMode\n>>> AwbMode\n>>> NoiseReductionMode\n>>> there will at some point be an AfMode and probably other AF ones\n>>> and so on.\n>>>\n>>> Basically it looks to be mostly anything with \"Mode\" on the end,\n>>> though I think we will encounter some others too. Also anything with\n>>> \"State\" on the end is probably similar, though in this case we're\n>>> talking about reported values, not ones you can set.\n>>\n>> Looks like these are defined in src/libcamera/control_ids.yaml, so we\n>> could have a script that generates pybind11 code to create the enums. Or\n>> we could just do it by hand.\n> \n> Defining them by hand is fine with me, at least for the time being. I\n> just wonder whether it would get annoying in the longer run, so some\n> kind of script in the build system might be helpful.\n> \n>>\n>> Is that your question, how and where to define the python enums? Or do\n>> you think there's some issue using those?\n> \n> I don't think there's any problem, I guess I'm just flagging that\n> there's something we probably need to do. I could define them all in\n> Picamera2, but it seems like everyone using these Python bindings\n> would appreciate them, so they probably belong in libcamera somewhere.\n\nOk. I hacked a quick script. Here's a snippet to add to the py .c file if you want to try them:\n\n\n\tpy::enum_<libcamera::controls::AeMeteringModeEnum>(m, \"AeMeteringMode\")\n\t\t.value(\"CentreWeighted\", libcamera::controls::MeteringCentreWeighted)\n\t\t.value(\"Spot\", libcamera::controls::MeteringSpot)\n\t\t.value(\"Matrix\", libcamera::controls::MeteringMatrix)\n\t\t.value(\"Custom\", libcamera::controls::MeteringCustom)\n\t;\n\tpy::enum_<libcamera::controls::AeConstraintModeEnum>(m, \"AeConstraintMode\")\n\t\t.value(\"Normal\", libcamera::controls::ConstraintNormal)\n\t\t.value(\"Highlight\", libcamera::controls::ConstraintHighlight)\n\t\t.value(\"Shadows\", libcamera::controls::ConstraintShadows)\n\t\t.value(\"Custom\", libcamera::controls::ConstraintCustom)\n\t;\n\tpy::enum_<libcamera::controls::AeExposureModeEnum>(m, \"AeExposureMode\")\n\t\t.value(\"Normal\", libcamera::controls::ExposureNormal)\n\t\t.value(\"Short\", libcamera::controls::ExposureShort)\n\t\t.value(\"Long\", libcamera::controls::ExposureLong)\n\t\t.value(\"Custom\", libcamera::controls::ExposureCustom)\n\t;\n\tpy::enum_<libcamera::controls::AwbModeEnum>(m, \"AwbMode\")\n\t\t.value(\"Auto\", libcamera::controls::AwbAuto)\n\t\t.value(\"Incandescent\", libcamera::controls::AwbIncandescent)\n\t\t.value(\"Tungsten\", libcamera::controls::AwbTungsten)\n\t\t.value(\"Fluorescent\", libcamera::controls::AwbFluorescent)\n\t\t.value(\"Indoor\", libcamera::controls::AwbIndoor)\n\t\t.value(\"Daylight\", libcamera::controls::AwbDaylight)\n\t\t.value(\"Cloudy\", libcamera::controls::AwbCloudy)\n\t\t.value(\"Custom\", libcamera::controls::AwbCustom)\n\t;\n\tpy::enum_<libcamera::controls::draft::AePrecaptureTriggerEnum>(m, \"AePrecaptureTrigger\")\n\t\t.value(\"Idle\", libcamera::controls::draft::AePrecaptureTriggerIdle)\n\t\t.value(\"Start\", libcamera::controls::draft::AePrecaptureTriggerStart)\n\t\t.value(\"Cancel\", libcamera::controls::draft::AePrecaptureTriggerCancel)\n\t;\n\tpy::enum_<libcamera::controls::draft::AfTriggerEnum>(m, \"AfTrigger\")\n\t\t.value(\"Idle\", libcamera::controls::draft::AfTriggerIdle)\n\t\t.value(\"Start\", libcamera::controls::draft::AfTriggerStart)\n\t\t.value(\"Cancel\", libcamera::controls::draft::AfTriggerCancel)\n\t;\n\tpy::enum_<libcamera::controls::draft::NoiseReductionModeEnum>(m, \"NoiseReductionMode\")\n\t\t.value(\"Off\", libcamera::controls::draft::NoiseReductionModeOff)\n\t\t.value(\"Fast\", libcamera::controls::draft::NoiseReductionModeFast)\n\t\t.value(\"HighQuality\", libcamera::controls::draft::NoiseReductionModeHighQuality)\n\t\t.value(\"Minimal\", libcamera::controls::draft::NoiseReductionModeMinimal)\n\t\t.value(\"ZSL\", libcamera::controls::draft::NoiseReductionModeZSL)\n\t;\n\tpy::enum_<libcamera::controls::draft::ColorCorrectionAberrationModeEnum>(m, \"ColorCorrectionAberrationMode\")\n\t\t.value(\"Off\", libcamera::controls::draft::ColorCorrectionAberrationOff)\n\t\t.value(\"Fast\", libcamera::controls::draft::ColorCorrectionAberrationFast)\n\t\t.value(\"HighQuality\", libcamera::controls::draft::ColorCorrectionAberrationHighQuality)\n\t;\n\tpy::enum_<libcamera::controls::draft::AeStateEnum>(m, \"AeState\")\n\t\t.value(\"Inactive\", libcamera::controls::draft::AeStateInactive)\n\t\t.value(\"Searching\", libcamera::controls::draft::AeStateSearching)\n\t\t.value(\"Converged\", libcamera::controls::draft::AeStateConverged)\n\t\t.value(\"Locked\", libcamera::controls::draft::AeStateLocked)\n\t\t.value(\"FlashRequired\", libcamera::controls::draft::AeStateFlashRequired)\n\t\t.value(\"Precapture\", libcamera::controls::draft::AeStatePrecapture)\n\t;\n\tpy::enum_<libcamera::controls::draft::AfStateEnum>(m, \"AfState\")\n\t\t.value(\"Inactive\", libcamera::controls::draft::AfStateInactive)\n\t\t.value(\"PassiveScan\", libcamera::controls::draft::AfStatePassiveScan)\n\t\t.value(\"PassiveFocused\", libcamera::controls::draft::AfStatePassiveFocused)\n\t\t.value(\"ActiveScan\", libcamera::controls::draft::AfStateActiveScan)\n\t\t.value(\"FocusedLock\", libcamera::controls::draft::AfStateFocusedLock)\n\t\t.value(\"NotFocusedLock\", libcamera::controls::draft::AfStateNotFocusedLock)\n\t\t.value(\"PassiveUnfocused\", libcamera::controls::draft::AfStatePassiveUnfocused)\n\t;\n\tpy::enum_<libcamera::controls::draft::AwbStateEnum>(m, \"AwbState\")\n\t\t.value(\"StateInactive\", libcamera::controls::draft::AwbStateInactive)\n\t\t.value(\"StateSearching\", libcamera::controls::draft::AwbStateSearching)\n\t\t.value(\"Converged\", libcamera::controls::draft::AwbConverged)\n\t\t.value(\"Locked\", libcamera::controls::draft::AwbLocked)\n\t;\n\tpy::enum_<libcamera::controls::draft::LensShadingMapModeEnum>(m, \"LensShadingMapMode\")\n\t\t.value(\"Off\", libcamera::controls::draft::LensShadingMapModeOff)\n\t\t.value(\"On\", libcamera::controls::draft::LensShadingMapModeOn)\n\t;\n\tpy::enum_<libcamera::controls::draft::SceneFlickerEnum>(m, \"SceneFlicker\")\n\t\t.value(\"Off\", libcamera::controls::draft::SceneFickerOff)\n\t\t.value(\"50Hz\", libcamera::controls::draft::SceneFicker50Hz)\n\t\t.value(\"60Hz\", libcamera::controls::draft::SceneFicker60Hz)\n\t;\n\tpy::enum_<libcamera::controls::draft::TestPatternModeEnum>(m, \"TestPatternMode\")\n\t\t.value(\"Off\", libcamera::controls::draft::TestPatternModeOff)\n\t\t.value(\"SolidColor\", libcamera::controls::draft::TestPatternModeSolidColor)\n\t\t.value(\"ColorBars\", libcamera::controls::draft::TestPatternModeColorBars)\n\t\t.value(\"ColorBarsFadeToGray\", libcamera::controls::draft::TestPatternModeColorBarsFadeToGray)\n\t\t.value(\"Pn9\", libcamera::controls::draft::TestPatternModePn9)\n\t\t.value(\"Custom1\", libcamera::controls::draft::TestPatternModeCustom1)\n\t;","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 7A87CBDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Mar 2022 11:36:27 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C47A3604E9;\n\tThu, 17 Mar 2022 12:36:26 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7A4A3601F8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 12:36:25 +0100 (CET)","from [192.168.1.111] (91-156-85-209.elisa-laajakaista.fi\n\t[91.156.85.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id CEB03493;\n\tThu, 17 Mar 2022 12:36:24 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647516986;\n\tbh=LBIn8w2QKEtDOVCuAhXeXYVdRGR25GQaL2ovED84OWM=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=R1FpsYdcH9RQtLG0hDOFLNhmug5vVQSYp/qGm2iei6QRCYYrElKHWISFnm7FNupiY\n\tClFNS5DjfhFdXZXhoYOep+CXURqdM2xUZqigyZ2nAQAzigZXRqUbAo7uZjN4gYFZzg\n\toCVGdSR9Hn0CoXuHQgXoFFW+x2NJ/zwdA1TgBbfTc/D7fRqR9G79O4MfX783Y907AC\n\tEZ6cN+Dn1+9YtDjrHbKjJ4iK4IjEDrvjcRv523Wm+aEI05sP3VnBPaJ95xgXCe4s7F\n\tD18HHy0sEu/mxsTZRy+kUp1ZI6nKol2Jfm/OBWhc4ggAaMes/vjQ8vdm7Y5uj20D3X\n\t+nZBT45lFY7fA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1647516985;\n\tbh=LBIn8w2QKEtDOVCuAhXeXYVdRGR25GQaL2ovED84OWM=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=KDQZc3E+rTmioqGX5Wnp7c1o5exZS1VNZNZUjE3S9LZdPFx7GKcQLBH6P030YruNw\n\tiBsVS2gG9uBGPzleECy4j26pA9PDrNku8baXD3rGUt8dBhEr93kQGiFjvjxanFGBvE\n\tnjspdEHqfh6IxI2xFXbPO+tc9aeJtMcOHiiDhOpc="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"KDQZc3E+\"; dkim-atps=neutral","Message-ID":"<183934ca-36d6-e8f2-11fe-d580e03630f8@ideasonboard.com>","Date":"Thu, 17 Mar 2022 13:36:21 +0200","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.5.0","Content-Language":"en-US","To":"David Plowman <david.plowman@raspberrypi.com>","References":"<20220314154633.506026-1-tomi.valkeinen@ideasonboard.com>\n\t<CAHW6GYLW3rqbd-DHMxtFaqU_ad=-r7ZKzkPB_jxENrUWyO9viw@mail.gmail.com>\n\t<34fdecb6-4a1e-740a-a318-ac1d8ea5f1e3@ideasonboard.com>\n\t<CAHW6GY+PAV_9P4ikPv3mdFCNLNQTbmhgcBe=+d_SK4R9Z7=1Vg@mail.gmail.com>\n\t<13f598d1-98e0-4830-cc9f-5e56ee932c07@ideasonboard.com>\n\t<CAHW6GYK_CeB35PCqduBOma1-rMiYj8-NejM21Sc6vJZ8CXi_vw@mail.gmail.com>","In-Reply-To":"<CAHW6GYK_CeB35PCqduBOma1-rMiYj8-NejM21Sc6vJZ8CXi_vw@mail.gmail.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","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":"Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22316,"web_url":"https://patchwork.libcamera.org/comment/22316/","msgid":"<CAHW6GYJKZ9ztMkAgd4FjkH6WBVewKcJ=D_VAgxqMeVFofZODGw@mail.gmail.com>","date":"2022-03-17T11:46:47","subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"Cool, thanks, I'll try those and let you know!\n\nDavid\n\nOn Thu, 17 Mar 2022 at 11:36, Tomi Valkeinen\n<tomi.valkeinen@ideasonboard.com> wrote:\n>\n> On 17/03/2022 13:01, David Plowman wrote:\n> > Hi again\n> >\n> > On Thu, 17 Mar 2022 at 10:41, Tomi Valkeinen\n> > <tomi.valkeinen@ideasonboard.com> wrote:\n> >>\n> >> On 17/03/2022 12:12, David Plowman wrote:\n> >>> Hi again\n> >>>\n> >>> Just to answer the about about the \"enum\" type controls:\n> >>>\n> >>> On Thu, 17 Mar 2022 at 09:55, Tomi Valkeinen\n> >>> <tomi.valkeinen@ideasonboard.com> wrote:\n> >>>>\n> >>>> On 17/03/2022 11:44, David Plowman wrote:\n> >>>>> Hi everyone\n> >>>>>\n> >>>>> Thanks for the update!\n> >>>>>\n> >>>>> On Mon, 14 Mar 2022 at 15:46, Tomi Valkeinen\n> >>>>> <tomi.valkeinen@ideasonboard.com> wrote:\n> >>>>>>\n> >>>>>> Hi,\n> >>>>>>\n> >>>>>> This is v5 of the series. The changes to v4:\n> >>>>>>\n> >>>>>> - Changed to pybind11 'smart_holders' branch which allows us to drop the\n> >>>>>>      HACK for Camera public destructor\n> >>>>>> - Changed Request.set_control() so that we can drop the HACK for\n> >>>>>>      exposing Camera from Request\n> >>>>>> - Moved Python enum defs to a separate file for clarity\n> >>>>>> - \"Forward\" declare Python classes to fix docstring issues.\n> >>>>>>\n> >>>>>> The set_control change breaks the current users of that function.\n> >>>>>> Previously you could do this:\n> >>>>>>\n> >>>>>> req.set_control(\"Brightness\", 1)\n> >>>>>>\n> >>>>>> Now you need to do:\n> >>>>>>\n> >>>>>> cid = camera.find_control(\"Brightness\")\n> >>>>>> req.set_control(cid, 1)\n> >>>>>>\n> >>>>>\n> >>>>> I see the need for this, and I guess it's fine - obviously we'll hide\n> >>>>> that under our Picamera2 API as we wouldn't want our users to have to\n> >>>>> do that!\n> >>>>\n> >>>> Yes, it's not very nice. Then again, having to do a string search every\n> >>>> time we call set_control is not good either, at least if we can avoid it\n> >>>> (and we can, as above). But I agree that in a higher level API things\n> >>>> should be easy. Of course, it would be nice to have both versions even\n> >>>> in this low level API, but... if Request doesn't expose camera, I don't\n> >>>> think we can do it in a simple way.\n> >>>>\n> >>>>> There is one further thing I wanted to raise in relation to the Python\n> >>>>> bindings for controls, now that a few folks are trying out Picamera2.\n> >>>>>\n> >>>>> I've had feedback that they don't like the fact that all the \"enum\"\n> >>>>> control values (exposure modes, AWB modes, that kind of thing) are\n> >>>>> simple integers up in the Python world. They complain that this makes\n> >>>>> them quite unfriendly to use, and I'm inclined to agree! We could\n> >>>>> always create Python-level definitions for them, and possibly add code\n> >>>>> to convert stuff on the fly, but I wonder if Pybind11 can do anything\n> >>>>> more automatic for us?\n> >>>>\n> >>>> Can you elaborate? Which enums are these?\n> >>>\n> >>> So users would prefer to write something like\n> >>>\n> >>> picamera2.set_controls({\"AwbMode\": AwbMode.Indoor})\n> >>>\n> >>> rather than\n> >>>\n> >>> picamera2.set_controls({\"AwbMode\": 4})\n> >>>\n> >>> The same applies to all the controls of this type, there including\n> >>>\n> >>> AeMeteringMode\n> >>> AeConstraintMode\n> >>> AeExposureMode\n> >>> AwbMode\n> >>> NoiseReductionMode\n> >>> there will at some point be an AfMode and probably other AF ones\n> >>> and so on.\n> >>>\n> >>> Basically it looks to be mostly anything with \"Mode\" on the end,\n> >>> though I think we will encounter some others too. Also anything with\n> >>> \"State\" on the end is probably similar, though in this case we're\n> >>> talking about reported values, not ones you can set.\n> >>\n> >> Looks like these are defined in src/libcamera/control_ids.yaml, so we\n> >> could have a script that generates pybind11 code to create the enums. Or\n> >> we could just do it by hand.\n> >\n> > Defining them by hand is fine with me, at least for the time being. I\n> > just wonder whether it would get annoying in the longer run, so some\n> > kind of script in the build system might be helpful.\n> >\n> >>\n> >> Is that your question, how and where to define the python enums? Or do\n> >> you think there's some issue using those?\n> >\n> > I don't think there's any problem, I guess I'm just flagging that\n> > there's something we probably need to do. I could define them all in\n> > Picamera2, but it seems like everyone using these Python bindings\n> > would appreciate them, so they probably belong in libcamera somewhere.\n>\n> Ok. I hacked a quick script. Here's a snippet to add to the py .c file if you want to try them:\n>\n>\n>         py::enum_<libcamera::controls::AeMeteringModeEnum>(m, \"AeMeteringMode\")\n>                 .value(\"CentreWeighted\", libcamera::controls::MeteringCentreWeighted)\n>                 .value(\"Spot\", libcamera::controls::MeteringSpot)\n>                 .value(\"Matrix\", libcamera::controls::MeteringMatrix)\n>                 .value(\"Custom\", libcamera::controls::MeteringCustom)\n>         ;\n>         py::enum_<libcamera::controls::AeConstraintModeEnum>(m, \"AeConstraintMode\")\n>                 .value(\"Normal\", libcamera::controls::ConstraintNormal)\n>                 .value(\"Highlight\", libcamera::controls::ConstraintHighlight)\n>                 .value(\"Shadows\", libcamera::controls::ConstraintShadows)\n>                 .value(\"Custom\", libcamera::controls::ConstraintCustom)\n>         ;\n>         py::enum_<libcamera::controls::AeExposureModeEnum>(m, \"AeExposureMode\")\n>                 .value(\"Normal\", libcamera::controls::ExposureNormal)\n>                 .value(\"Short\", libcamera::controls::ExposureShort)\n>                 .value(\"Long\", libcamera::controls::ExposureLong)\n>                 .value(\"Custom\", libcamera::controls::ExposureCustom)\n>         ;\n>         py::enum_<libcamera::controls::AwbModeEnum>(m, \"AwbMode\")\n>                 .value(\"Auto\", libcamera::controls::AwbAuto)\n>                 .value(\"Incandescent\", libcamera::controls::AwbIncandescent)\n>                 .value(\"Tungsten\", libcamera::controls::AwbTungsten)\n>                 .value(\"Fluorescent\", libcamera::controls::AwbFluorescent)\n>                 .value(\"Indoor\", libcamera::controls::AwbIndoor)\n>                 .value(\"Daylight\", libcamera::controls::AwbDaylight)\n>                 .value(\"Cloudy\", libcamera::controls::AwbCloudy)\n>                 .value(\"Custom\", libcamera::controls::AwbCustom)\n>         ;\n>         py::enum_<libcamera::controls::draft::AePrecaptureTriggerEnum>(m, \"AePrecaptureTrigger\")\n>                 .value(\"Idle\", libcamera::controls::draft::AePrecaptureTriggerIdle)\n>                 .value(\"Start\", libcamera::controls::draft::AePrecaptureTriggerStart)\n>                 .value(\"Cancel\", libcamera::controls::draft::AePrecaptureTriggerCancel)\n>         ;\n>         py::enum_<libcamera::controls::draft::AfTriggerEnum>(m, \"AfTrigger\")\n>                 .value(\"Idle\", libcamera::controls::draft::AfTriggerIdle)\n>                 .value(\"Start\", libcamera::controls::draft::AfTriggerStart)\n>                 .value(\"Cancel\", libcamera::controls::draft::AfTriggerCancel)\n>         ;\n>         py::enum_<libcamera::controls::draft::NoiseReductionModeEnum>(m, \"NoiseReductionMode\")\n>                 .value(\"Off\", libcamera::controls::draft::NoiseReductionModeOff)\n>                 .value(\"Fast\", libcamera::controls::draft::NoiseReductionModeFast)\n>                 .value(\"HighQuality\", libcamera::controls::draft::NoiseReductionModeHighQuality)\n>                 .value(\"Minimal\", libcamera::controls::draft::NoiseReductionModeMinimal)\n>                 .value(\"ZSL\", libcamera::controls::draft::NoiseReductionModeZSL)\n>         ;\n>         py::enum_<libcamera::controls::draft::ColorCorrectionAberrationModeEnum>(m, \"ColorCorrectionAberrationMode\")\n>                 .value(\"Off\", libcamera::controls::draft::ColorCorrectionAberrationOff)\n>                 .value(\"Fast\", libcamera::controls::draft::ColorCorrectionAberrationFast)\n>                 .value(\"HighQuality\", libcamera::controls::draft::ColorCorrectionAberrationHighQuality)\n>         ;\n>         py::enum_<libcamera::controls::draft::AeStateEnum>(m, \"AeState\")\n>                 .value(\"Inactive\", libcamera::controls::draft::AeStateInactive)\n>                 .value(\"Searching\", libcamera::controls::draft::AeStateSearching)\n>                 .value(\"Converged\", libcamera::controls::draft::AeStateConverged)\n>                 .value(\"Locked\", libcamera::controls::draft::AeStateLocked)\n>                 .value(\"FlashRequired\", libcamera::controls::draft::AeStateFlashRequired)\n>                 .value(\"Precapture\", libcamera::controls::draft::AeStatePrecapture)\n>         ;\n>         py::enum_<libcamera::controls::draft::AfStateEnum>(m, \"AfState\")\n>                 .value(\"Inactive\", libcamera::controls::draft::AfStateInactive)\n>                 .value(\"PassiveScan\", libcamera::controls::draft::AfStatePassiveScan)\n>                 .value(\"PassiveFocused\", libcamera::controls::draft::AfStatePassiveFocused)\n>                 .value(\"ActiveScan\", libcamera::controls::draft::AfStateActiveScan)\n>                 .value(\"FocusedLock\", libcamera::controls::draft::AfStateFocusedLock)\n>                 .value(\"NotFocusedLock\", libcamera::controls::draft::AfStateNotFocusedLock)\n>                 .value(\"PassiveUnfocused\", libcamera::controls::draft::AfStatePassiveUnfocused)\n>         ;\n>         py::enum_<libcamera::controls::draft::AwbStateEnum>(m, \"AwbState\")\n>                 .value(\"StateInactive\", libcamera::controls::draft::AwbStateInactive)\n>                 .value(\"StateSearching\", libcamera::controls::draft::AwbStateSearching)\n>                 .value(\"Converged\", libcamera::controls::draft::AwbConverged)\n>                 .value(\"Locked\", libcamera::controls::draft::AwbLocked)\n>         ;\n>         py::enum_<libcamera::controls::draft::LensShadingMapModeEnum>(m, \"LensShadingMapMode\")\n>                 .value(\"Off\", libcamera::controls::draft::LensShadingMapModeOff)\n>                 .value(\"On\", libcamera::controls::draft::LensShadingMapModeOn)\n>         ;\n>         py::enum_<libcamera::controls::draft::SceneFlickerEnum>(m, \"SceneFlicker\")\n>                 .value(\"Off\", libcamera::controls::draft::SceneFickerOff)\n>                 .value(\"50Hz\", libcamera::controls::draft::SceneFicker50Hz)\n>                 .value(\"60Hz\", libcamera::controls::draft::SceneFicker60Hz)\n>         ;\n>         py::enum_<libcamera::controls::draft::TestPatternModeEnum>(m, \"TestPatternMode\")\n>                 .value(\"Off\", libcamera::controls::draft::TestPatternModeOff)\n>                 .value(\"SolidColor\", libcamera::controls::draft::TestPatternModeSolidColor)\n>                 .value(\"ColorBars\", libcamera::controls::draft::TestPatternModeColorBars)\n>                 .value(\"ColorBarsFadeToGray\", libcamera::controls::draft::TestPatternModeColorBarsFadeToGray)\n>                 .value(\"Pn9\", libcamera::controls::draft::TestPatternModePn9)\n>                 .value(\"Custom1\", libcamera::controls::draft::TestPatternModeCustom1)\n>         ;\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 A32AABF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Mar 2022 11:47:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id ED0A7604E9;\n\tThu, 17 Mar 2022 12:46:59 +0100 (CET)","from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com\n\t[IPv6:2a00:1450:4864:20::42f])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 99C48601F8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 12:46:58 +0100 (CET)","by mail-wr1-x42f.google.com with SMTP id h23so6376057wrb.8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 04:46:58 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647517620;\n\tbh=MMdxaTR9nCL1oz6h6MX+boass5gF/k8pzIoXx8qns1E=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=IRFAMclkktsw592TuuIu2H2P+aiPSAG2UjmfubNGvqoiKf/655mcsil9DBanRDE5Y\n\td41dVhmbZaf8sAXjp3Dot3ShLQwUpdsxCInFLBmWIYrPnBgLOQxpdFbxv54GjvVI5s\n\tCII3z4eRHqszvRyHm53NnDlNis1X32ZqoY/VJpTSObHazzth2ZSzeKxwF0iSKtCuQC\n\t97y+2WW42R2dUoIWmqw5pkw1c8jwOdpgOktQa2/QVdnbiVrACOi0AZ2y9azd3jdSNT\n\t2/KcEt/mGTsynKWBrhESI9r1tVJ1wL6a1MgW0HzZEK09qSxVEwD6MYYzBsOu3IsdYq\n\tybr4d5goXlyog==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=xcMBf08zgbRXi7EL4wBVcV6iyQPcIQiBYc/QR9cqDX0=;\n\tb=YcqGIGu4TOib0GlGpxbQjqIqdwcid3FVrvPrgw8GnI5CMRyr1koxMXyGlCqwei2H+T\n\t9kubNSVHAGTvnHfAzsDTXqVMRB+aNFSyJ4NC2ROuo7rVdyxiuVzX+zAefmolGRohCbW5\n\tJmeu9L9SGMOChw8oMDMQ0SqvUaFv+p3sHxa6fZnpTMyXUXB3i+m1g4Ro21wj5s9ETw8A\n\tDP2d4CMyFznGe9QKllUe+HoXjiRYFSQHKxXuuWPpa/jWw7jv3XXPOfAGN2x3o6oKIbIV\n\t46FJOHuaG6eKaglO545txQ5TAg2Uz94rEnkBUw3iAbYjTkVTZ8YmKNspfGFNLRp11PzY\n\ttI5g=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"YcqGIGu4\"; 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:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=xcMBf08zgbRXi7EL4wBVcV6iyQPcIQiBYc/QR9cqDX0=;\n\tb=xiwv5eoly272liZ3qTO+7MJl3PhE8m59UWgjgiBiczLZotoeXvwvUr2KCKGPw3MWi0\n\tp2ntmJJpEXCgZyBBZEMJ63pwWDZ7r9t4qG1hPRyvNIyCkP11L4IYreCq7gF9zJaMx4IN\n\tXQbv9UbPrqGB40ZZsJZrlZ4PR7eMrNExpAdle91CcOn0c9LgDfTJyy4wN7RAZ7okmHtt\n\tnXRIB/lCq4AlJL90UnhCsfan+4ZWjRTtDr3t1uToteHcOTLvUpaPzmJp7bwvorZgiV55\n\tjM+gGfoTtnU934ISNQKp0ANgwhGjdpwrTacJboIpdtJPQyJtZ4G+e5dvQ6TIQFGp+uzG\n\tIWyw==","X-Gm-Message-State":"AOAM531zn6n3XH96GsZFKYpYzxwaiXv8fq0fdBvHHo3c5pwNJNx6yT+n\n\trhD+KI/lfuZEjxH1jabSOfz5Oj59/coTNaxo2blw2w==","X-Google-Smtp-Source":"ABdhPJxAgVN6XH+qtA4adWipioHYbjdSfk3TLBZDkRinG+dH+vWsHL6bcIgW6PlsEnUNKebdLN0F9ZMy57QKMCVeJUE=","X-Received":"by 2002:a5d:404c:0:b0:203:ea4e:3c07 with SMTP id\n\tw12-20020a5d404c000000b00203ea4e3c07mr2200056wrp.597.1647517618181;\n\tThu, 17 Mar 2022 04:46:58 -0700 (PDT)","MIME-Version":"1.0","References":"<20220314154633.506026-1-tomi.valkeinen@ideasonboard.com>\n\t<CAHW6GYLW3rqbd-DHMxtFaqU_ad=-r7ZKzkPB_jxENrUWyO9viw@mail.gmail.com>\n\t<34fdecb6-4a1e-740a-a318-ac1d8ea5f1e3@ideasonboard.com>\n\t<CAHW6GY+PAV_9P4ikPv3mdFCNLNQTbmhgcBe=+d_SK4R9Z7=1Vg@mail.gmail.com>\n\t<13f598d1-98e0-4830-cc9f-5e56ee932c07@ideasonboard.com>\n\t<CAHW6GYK_CeB35PCqduBOma1-rMiYj8-NejM21Sc6vJZ8CXi_vw@mail.gmail.com>\n\t<183934ca-36d6-e8f2-11fe-d580e03630f8@ideasonboard.com>","In-Reply-To":"<183934ca-36d6-e8f2-11fe-d580e03630f8@ideasonboard.com>","Date":"Thu, 17 Mar 2022 11:46:47 +0000","Message-ID":"<CAHW6GYJKZ9ztMkAgd4FjkH6WBVewKcJ=D_VAgxqMeVFofZODGw@mail.gmail.com>","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22317,"web_url":"https://patchwork.libcamera.org/comment/22317/","msgid":"<164751781044.123014.12481344276890139660@Monstersaurus>","date":"2022-03-17T11:50:10","subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"Quoting Tomi Valkeinen (2022-03-17 10:03:25)\n> On 17/03/2022 11:55, Tomi Valkeinen wrote:\n> > On 17/03/2022 11:44, David Plowman wrote:\n> >> Hi everyone\n> >>\n> >> Thanks for the update!\n> >>\n> >> On Mon, 14 Mar 2022 at 15:46, Tomi Valkeinen\n> >> <tomi.valkeinen@ideasonboard.com> wrote:\n> >>>\n> >>> Hi,\n> >>>\n> >>> This is v5 of the series. The changes to v4:\n> >>>\n> >>> - Changed to pybind11 'smart_holders' branch which allows us to drop the\n> >>>    HACK for Camera public destructor\n> >>> - Changed Request.set_control() so that we can drop the HACK for\n> >>>    exposing Camera from Request\n> >>> - Moved Python enum defs to a separate file for clarity\n> >>> - \"Forward\" declare Python classes to fix docstring issues.\n> >>>\n> >>> The set_control change breaks the current users of that function.\n> >>> Previously you could do this:\n> >>>\n> >>> req.set_control(\"Brightness\", 1)\n> >>>\n> >>> Now you need to do:\n> >>>\n> >>> cid = camera.find_control(\"Brightness\")\n> >>> req.set_control(cid, 1)\n> >>>\n> >>\n> >> I see the need for this, and I guess it's fine - obviously we'll hide\n> >> that under our Picamera2 API as we wouldn't want our users to have to\n> >> do that!\n> \n> I think the core question is whether a Request is tied to a Camera. I \n> thought it is, as it is created from the Camera. And if that's the case, \n> I don't see why the Camera cannot be exposed from the Request.\n\nThis is how I understand it, and the patch I have/had locally to add and\nexpose this is followed by an addition of an error check to make sure\nthat requests queued to a camera that were not created by that camera get\nrejected.\n\nI could probably still do that using the private class infrastructure\nnow though. (re-sketching up that patch now).\n\n> Maybe Laurent can explain the reasons why not to expose it.\n> \n> > Yes, it's not very nice. Then again, having to do a string search every \n> > time we call set_control is not good either, at least if we can avoid it \n> > (and we can, as above). But I agree that in a higher level API things \n> > should be easy. Of course, it would be nice to have both versions even \n> > in this low level API, but... if Request doesn't expose camera, I don't \n> > think we can do it in a simple way.\n> \n> Note that there are multiple ways to approach this. E.g.:\n> \n> req.set_control(camera.controls[\"Brightness\"], 1)\n> \n> or:\n> \n> req.set_control(camera.controls.Brightness, 1)\n> \n> or even (although this could perhaps conflict too easily):\n> \n> req.set_control(camera.Brightness, 1)\n> \n> Or we could go the other way:\n> \n> camera.set_control(req, \"Brightness\", 1)\n> \n> or:\n> \n> camera.controls.Brightness.set(req, 1)\n> \n>   Tomi","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 9DC1FBDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Mar 2022 11:50:15 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id F1837604E9;\n\tThu, 17 Mar 2022 12:50:14 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id AF5F5601F8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 12:50:13 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 43BCEEE;\n\tThu, 17 Mar 2022 12:50:13 +0100 (CET)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647517815;\n\tbh=emLLr5LLLc6RL5NtFLYONbI65LzaI6O3wjzzzZv8Vps=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=oE4uwoNJAiQEDsQk0Yi8tfc3RzjN/7NMrtT0fyq89QrHREdCWzwblVejYRXxZksuI\n\taQMDFjN7GIHpasLRHVQqC6iaeRXzUqR2SokzaHOru5sxwXwIPZCYbbGhTzzk9WZIRI\n\ts5tk/cKvJP+GLVsrRsbUeYa9yOO4qAAl7myFjr83vy8rc2IKZBNSBqigwGNDpRzJD9\n\tnBxoPKtY2+yiLVULD6ZWrCurQBajLch7WtSeb1rb3/O4ZETogL4iGaBpzuEQ7Ic93i\n\tBuc4YoKIYcFnNNdFVGOvQ9kdNInGw6F7PYi3nugZrfkEqylRUY2JFAeF0DThguc4BD\n\t9aDNxyYaoR3Dg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1647517813;\n\tbh=emLLr5LLLc6RL5NtFLYONbI65LzaI6O3wjzzzZv8Vps=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=wQ1j53mtRZnXiPwBuQKwevGtlAa4Rs3Ieu0Xc3cjR9DQ6aO0fLl4p9V639N+NyVU0\n\t6venvch4JxBu1lNQja8EUHn3Zn4zfjgCatzDgF3CccFcvJdMXeHjGxmBjWTXVVMyeq\n\tlyjqt9V+iRH3tTF7QJtyB4aNcUiU06Br6WRVflzk="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"wQ1j53mt\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<029f59f0-50a0-0da2-eae3-ad97769f5556@ideasonboard.com>","References":"<20220314154633.506026-1-tomi.valkeinen@ideasonboard.com>\n\t<CAHW6GYLW3rqbd-DHMxtFaqU_ad=-r7ZKzkPB_jxENrUWyO9viw@mail.gmail.com>\n\t<34fdecb6-4a1e-740a-a318-ac1d8ea5f1e3@ideasonboard.com>\n\t<029f59f0-50a0-0da2-eae3-ad97769f5556@ideasonboard.com>","To":"David Plowman <david.plowman@raspberrypi.com>,\n\tTomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Date":"Thu, 17 Mar 2022 11:50:10 +0000","Message-ID":"<164751781044.123014.12481344276890139660@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","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":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22319,"web_url":"https://patchwork.libcamera.org/comment/22319/","msgid":"<CAHW6GYLPwCBpXQh8N3tGCv70Uc+ZvNjwTTBz9b+rigChnbU3Vg@mail.gmail.com>","date":"2022-03-17T14:03:57","subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","submitter":{"id":97,"url":"https://patchwork.libcamera.org/api/people/97/","name":"Nicolas Dufresne via libcamera-devel","email":"libcamera-devel@lists.libcamera.org"},"content":"Hi Tomi\n\nThanks for those py::enum definitions - they work great, for example:\n\"picamera2.set_controls({\"AwbMode\": libcamera.AwbMode.Indoor})\"\n\nDavid\n\nOn Thu, 17 Mar 2022 at 11:50, Kieran Bingham\n<kieran.bingham@ideasonboard.com> wrote:\n>\n> Quoting Tomi Valkeinen (2022-03-17 10:03:25)\n> > On 17/03/2022 11:55, Tomi Valkeinen wrote:\n> > > On 17/03/2022 11:44, David Plowman wrote:\n> > >> Hi everyone\n> > >>\n> > >> Thanks for the update!\n> > >>\n> > >> On Mon, 14 Mar 2022 at 15:46, Tomi Valkeinen\n> > >> <tomi.valkeinen@ideasonboard.com> wrote:\n> > >>>\n> > >>> Hi,\n> > >>>\n> > >>> This is v5 of the series. The changes to v4:\n> > >>>\n> > >>> - Changed to pybind11 'smart_holders' branch which allows us to drop the\n> > >>>    HACK for Camera public destructor\n> > >>> - Changed Request.set_control() so that we can drop the HACK for\n> > >>>    exposing Camera from Request\n> > >>> - Moved Python enum defs to a separate file for clarity\n> > >>> - \"Forward\" declare Python classes to fix docstring issues.\n> > >>>\n> > >>> The set_control change breaks the current users of that function.\n> > >>> Previously you could do this:\n> > >>>\n> > >>> req.set_control(\"Brightness\", 1)\n> > >>>\n> > >>> Now you need to do:\n> > >>>\n> > >>> cid = camera.find_control(\"Brightness\")\n> > >>> req.set_control(cid, 1)\n> > >>>\n> > >>\n> > >> I see the need for this, and I guess it's fine - obviously we'll hide\n> > >> that under our Picamera2 API as we wouldn't want our users to have to\n> > >> do that!\n> >\n> > I think the core question is whether a Request is tied to a Camera. I\n> > thought it is, as it is created from the Camera. And if that's the case,\n> > I don't see why the Camera cannot be exposed from the Request.\n>\n> This is how I understand it, and the patch I have/had locally to add and\n> expose this is followed by an addition of an error check to make sure\n> that requests queued to a camera that were not created by that camera get\n> rejected.\n>\n> I could probably still do that using the private class infrastructure\n> now though. (re-sketching up that patch now).\n>\n> > Maybe Laurent can explain the reasons why not to expose it.\n> >\n> > > Yes, it's not very nice. Then again, having to do a string search every\n> > > time we call set_control is not good either, at least if we can avoid it\n> > > (and we can, as above). But I agree that in a higher level API things\n> > > should be easy. Of course, it would be nice to have both versions even\n> > > in this low level API, but... if Request doesn't expose camera, I don't\n> > > think we can do it in a simple way.\n> >\n> > Note that there are multiple ways to approach this. E.g.:\n> >\n> > req.set_control(camera.controls[\"Brightness\"], 1)\n> >\n> > or:\n> >\n> > req.set_control(camera.controls.Brightness, 1)\n> >\n> > or even (although this could perhaps conflict too easily):\n> >\n> > req.set_control(camera.Brightness, 1)\n> >\n> > Or we could go the other way:\n> >\n> > camera.set_control(req, \"Brightness\", 1)\n> >\n> > or:\n> >\n> > camera.controls.Brightness.set(req, 1)\n> >\n> >   Tomi","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 D6A65BDE17\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 17 Mar 2022 14:04:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 25709604DC;\n\tThu, 17 Mar 2022 15:04:11 +0100 (CET)","from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com\n\t[IPv6:2a00:1450:4864:20::32e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 751D6601F8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 15:04:09 +0100 (CET)","by mail-wm1-x32e.google.com with SMTP id\n\t123-20020a1c1981000000b0038b3616a71aso3216958wmz.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 17 Mar 2022 07:04:09 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1647525851;\n\tbh=J+XTm2ABXzMtR9gHKsFYoZ+sU/bgoveovOX0ttZxiEg=;\n\th=References:In-Reply-To:Date:To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=KsWbSV1zi2v4rB+ohj1MFAWbfymC+lvFA0jQlwhNgYV0BGRC5MDFJzbbTwmcel7e9\n\tLabp6ymOvhvZQnkQ5Sjvi/EfQMjVFrerZhRXZZ3JxlNgpQWNw5rrOPocLpE2pYfoMa\n\tI6RHsjqaRaPuT8L6CJySlVGdBmh3+nxxsVPWsEJDYg0PW9x9gWTaLHW+h0kQ+Wb1TS\n\tPIzBnSh6lDlPH4hU7P4uV9MNqRH/iFf2+4FyMDgVCItEWfHjYwEg7EH038STmUVgqQ\n\ttZf2WWeI726CYxi2vTyZiRdDlLO7aauJlGtxZOcMqEQjeBF5JiTyRx/QsaK4dnTLtN\n\tDwVY+QAd5aaTQ==","v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=raspberrypi.com; s=google;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=62nPwVCqIaaQnnF3Ro3hsaeyS4S3FaJzBEN9uGN6De8=;\n\tb=fqK/Va3fUk6/PBz+9EpHag8/bHsaBSf8Zd24jdv8NOv3l9N/1hM3GBIQoPpd0uigvu\n\tIGii3SkP8Gk8DGor2NcDPC6vSiTAQYTo3tBOaLpv9gYhXdVsu+Kr+Ee95CnJAGwFJcuN\n\tkKw9gxJg48DSgCtkFe6xwWRmQccK53TMom7bJaIeboArQvSo1eADpRArAs9RqI53MUXX\n\t+aHUCQ32ywhuKMyaddRhLyjWoJPBvDE++Va5jbU/7rstSOQ6xZ+IkKPpUfNIPdKxiL3q\n\tB1aHC+h/xseIiVl93CBJHgbhBpXw2poQeAm1jXa0Av/PAyFPNDHqZLhYQ9LaiXYoUjOA\n\tbamw=="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key; \n\tunprotected) header.d=raspberrypi.com\n\theader.i=@raspberrypi.com\n\theader.b=\"fqK/Va3f\"; 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:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=62nPwVCqIaaQnnF3Ro3hsaeyS4S3FaJzBEN9uGN6De8=;\n\tb=iKmnkbeidMGiWnOwySijykpok9fwIg6G1B7Ai7fXGo8xSe1zstsSqHsfjhywuXWzK8\n\tTyw1X91QBh8wnA9fjyFNbOIxfOEEXTOTMoq4nzIh6OlK4oac46e03+tD6Apday9DeeiK\n\tLSsQ5Aa9c+b3ZDRuq9QtkT6yo7IM3Wx7y1dkMwGk1/4ruNStaJlCxqThG4ydUWFWWhv5\n\tC3lCrh7eQQi/F+9Tpn/g2tFnX8F+R80Utg/bxNHDe33JrDcmyeHSrzvDgTqr8JZ8WyJG\n\tMtlwbqmy6VqJtBn0EHX6obUiM+OoGpR2jWsMciFGHLsJLQC9VRO1rLQighvpkxRUorvY\n\tJzqg==","X-Gm-Message-State":"AOAM5316a8d3k6Y7jqatWY0l/2tXIgvnBjpu43ydLIub7MudCzF1dDRp\n\tXKfIT6jx1MH9Sz+pUO6UGkV9E959sxJQfcdtezCfnA==","X-Google-Smtp-Source":"ABdhPJzjqomtvtgHNl7i08uZGpGE5xnuSv9fhvMsxj10lEiuNwFm0oJPKJnzNQixrUTaLm7HQMeKyBlfnRPVwCk8yFA=","X-Received":"by 2002:a05:600c:3b13:b0:389:cf43:da5f with SMTP id\n\tm19-20020a05600c3b1300b00389cf43da5fmr11673209wms.201.1647525848961;\n\tThu, 17 Mar 2022 07:04:08 -0700 (PDT)","MIME-Version":"1.0","References":"<20220314154633.506026-1-tomi.valkeinen@ideasonboard.com>\n\t<CAHW6GYLW3rqbd-DHMxtFaqU_ad=-r7ZKzkPB_jxENrUWyO9viw@mail.gmail.com>\n\t<34fdecb6-4a1e-740a-a318-ac1d8ea5f1e3@ideasonboard.com>\n\t<029f59f0-50a0-0da2-eae3-ad97769f5556@ideasonboard.com>\n\t<164751781044.123014.12481344276890139660@Monstersaurus>","In-Reply-To":"<164751781044.123014.12481344276890139660@Monstersaurus>","Date":"Thu, 17 Mar 2022 14:03:57 +0000","Message-ID":"<CAHW6GYLPwCBpXQh8N3tGCv70Uc+ZvNjwTTBz9b+rigChnbU3Vg@mail.gmail.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","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>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22563,"web_url":"https://patchwork.libcamera.org/comment/22563/","msgid":"<52e4b737-afbe-b2f1-26a1-b2dadeee691a@ideasonboard.com>","date":"2022-04-05T06:47:16","subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"content":"Hi Laurent,\n\nOn 17/03/2022 13:50, Kieran Bingham wrote:\n> Quoting Tomi Valkeinen (2022-03-17 10:03:25)\n>> On 17/03/2022 11:55, Tomi Valkeinen wrote:\n>>> On 17/03/2022 11:44, David Plowman wrote:\n>>>> Hi everyone\n>>>>\n>>>> Thanks for the update!\n>>>>\n>>>> On Mon, 14 Mar 2022 at 15:46, Tomi Valkeinen\n>>>> <tomi.valkeinen@ideasonboard.com> wrote:\n>>>>>\n>>>>> Hi,\n>>>>>\n>>>>> This is v5 of the series. The changes to v4:\n>>>>>\n>>>>> - Changed to pybind11 'smart_holders' branch which allows us to drop the\n>>>>>     HACK for Camera public destructor\n>>>>> - Changed Request.set_control() so that we can drop the HACK for\n>>>>>     exposing Camera from Request\n>>>>> - Moved Python enum defs to a separate file for clarity\n>>>>> - \"Forward\" declare Python classes to fix docstring issues.\n>>>>>\n>>>>> The set_control change breaks the current users of that function.\n>>>>> Previously you could do this:\n>>>>>\n>>>>> req.set_control(\"Brightness\", 1)\n>>>>>\n>>>>> Now you need to do:\n>>>>>\n>>>>> cid = camera.find_control(\"Brightness\")\n>>>>> req.set_control(cid, 1)\n>>>>>\n>>>>\n>>>> I see the need for this, and I guess it's fine - obviously we'll hide\n>>>> that under our Picamera2 API as we wouldn't want our users to have to\n>>>> do that!\n>>\n>> I think the core question is whether a Request is tied to a Camera. I\n>> thought it is, as it is created from the Camera. And if that's the case,\n>> I don't see why the Camera cannot be exposed from the Request.\n> \n> This is how I understand it, and the patch I have/had locally to add and\n> expose this is followed by an addition of an error check to make sure\n> that requests queued to a camera that were not created by that camera get\n> rejected.\n> \n> I could probably still do that using the private class infrastructure\n> now though. (re-sketching up that patch now).\n> \n>> Maybe Laurent can explain the reasons why not to expose it.\n\nAny comment on this?\n\n  Tomi","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 BDDF9C3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  5 Apr 2022 06:47:21 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1161F65640;\n\tTue,  5 Apr 2022 08:47:21 +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 E52E4604B7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  5 Apr 2022 08:47:19 +0200 (CEST)","from [192.168.1.111] (91-156-85-209.elisa-laajakaista.fi\n\t[91.156.85.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1AF635D;\n\tTue,  5 Apr 2022 08:47:19 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1649141241;\n\tbh=eio9zuT5Wu2npi+23ZQ8M43Euvo6EYGGSWtUPuFPTw8=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=moEqvXeXCCca4dIY/+t98FPMmQ2wDkbAqYE6ALRHWbxeRVbc88/VGGYPsTdypPO7l\n\t+xPQEaYRc4h7vYCeMvHjppJugTm5Q+gEOBWVcv7STUYaAXHF1smNJ9zcpmecK59kqv\n\trH0QuRYdr6iXuavkusfMtiKBmiDDufKcY101PvjR+VUrKHrqg8/oTMcPklO51r16zr\n\t5K7PrfYZ1Dh4NJCi/nUcciZd8CKl5jg9IlQ2YVDnK7sK8v7U3fvYIULKlTkR5B/Dfb\n\tmxGohtyKxai4VLWB3UEeBe52kraMIGcg57qvR5J/z+LHBOvbOFZHrGjDijkITIQHz6\n\tTMjbycbX8kKeA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1649141239;\n\tbh=eio9zuT5Wu2npi+23ZQ8M43Euvo6EYGGSWtUPuFPTw8=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=ACr4v2Pxy8LOn0akAv9+0dZVOiyObgnTL5o8FWaCoplWVdjkcRwsyLqn2zaDoix9j\n\tfAYi8BSQ5nBdGd0IlIdru/huBwgYVt9j4ZjAmjQaKRDNzRXRU07jtg5miL+dThbe0N\n\ty4Z7Lf3eQhh4gv+zYXwO/JhvDXSaaF+0TDGten7E="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"ACr4v2Px\"; dkim-atps=neutral","Message-ID":"<52e4b737-afbe-b2f1-26a1-b2dadeee691a@ideasonboard.com>","Date":"Tue, 5 Apr 2022 09:47:16 +0300","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.7.0","Content-Language":"en-US","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","References":"<20220314154633.506026-1-tomi.valkeinen@ideasonboard.com>\n\t<CAHW6GYLW3rqbd-DHMxtFaqU_ad=-r7ZKzkPB_jxENrUWyO9viw@mail.gmail.com>\n\t<34fdecb6-4a1e-740a-a318-ac1d8ea5f1e3@ideasonboard.com>\n\t<029f59f0-50a0-0da2-eae3-ad97769f5556@ideasonboard.com>\n\t<164751781044.123014.12481344276890139660@Monstersaurus>","In-Reply-To":"<164751781044.123014.12481344276890139660@Monstersaurus>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","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":"Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22602,"web_url":"https://patchwork.libcamera.org/comment/22602/","msgid":"<YkzzL2n7fu6ZRQjD@pendragon.ideasonboard.com>","date":"2022-04-06T01:55:59","subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Tomi,\n\nOn Tue, Apr 05, 2022 at 09:47:16AM +0300, Tomi Valkeinen wrote:\n> On 17/03/2022 13:50, Kieran Bingham wrote:\n> > Quoting Tomi Valkeinen (2022-03-17 10:03:25)\n> >> On 17/03/2022 11:55, Tomi Valkeinen wrote:\n> >>> On 17/03/2022 11:44, David Plowman wrote:\n> >>>> Hi everyone\n> >>>>\n> >>>> Thanks for the update!\n> >>>>\n> >>>> On Mon, 14 Mar 2022 at 15:46, Tomi Valkeinen\n> >>>> <tomi.valkeinen@ideasonboard.com> wrote:\n> >>>>>\n> >>>>> Hi,\n> >>>>>\n> >>>>> This is v5 of the series. The changes to v4:\n> >>>>>\n> >>>>> - Changed to pybind11 'smart_holders' branch which allows us to drop the\n> >>>>>     HACK for Camera public destructor\n> >>>>> - Changed Request.set_control() so that we can drop the HACK for\n> >>>>>     exposing Camera from Request\n> >>>>> - Moved Python enum defs to a separate file for clarity\n> >>>>> - \"Forward\" declare Python classes to fix docstring issues.\n> >>>>>\n> >>>>> The set_control change breaks the current users of that function.\n> >>>>> Previously you could do this:\n> >>>>>\n> >>>>> req.set_control(\"Brightness\", 1)\n> >>>>>\n> >>>>> Now you need to do:\n> >>>>>\n> >>>>> cid = camera.find_control(\"Brightness\")\n> >>>>> req.set_control(cid, 1)\n> >>>>>\n> >>>>\n> >>>> I see the need for this, and I guess it's fine - obviously we'll hide\n> >>>> that under our Picamera2 API as we wouldn't want our users to have to\n> >>>> do that!\n> >>\n> >> I think the core question is whether a Request is tied to a Camera. I\n> >> thought it is, as it is created from the Camera. And if that's the case,\n> >> I don't see why the Camera cannot be exposed from the Request.\n> > \n> > This is how I understand it, and the patch I have/had locally to add and\n> > expose this is followed by an addition of an error check to make sure\n> > that requests queued to a camera that were not created by that camera get\n> > rejected.\n> > \n> > I could probably still do that using the private class infrastructure\n> > now though. (re-sketching up that patch now).\n> > \n> >> Maybe Laurent can explain the reasons why not to expose it.\n> \n> Any comment on this?\n\nAdded on my todo list, I'll sleep over that and try to reply before the\nend of the week.","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 DD66AC3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  6 Apr 2022 01:56:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5B9C26563F;\n\tWed,  6 Apr 2022 03:56:04 +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 17390604B6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  6 Apr 2022 03:56:03 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(117.145-247-81.adsl-dyn.isp.belgacom.be [81.247.145.117])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 88F5E482;\n\tWed,  6 Apr 2022 03:56:02 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1649210164;\n\tbh=d5g+7SAsXf6DQLw5ENNnK2zIXpOL45/pkqFtC/TdvHg=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=MMCET8yzrbNRm/AVe6cDkUaCYyprgS5YhWATNxiuhteOr/04N6rWNuzMibYeTikse\n\tujlHQ6uV16LINerSRDR/w4C8V74u8zlAVCgqnEzPfCggnrN9El+E/jT4NIL7+5rgM3\n\tDTcobpIeZIUgIw31UhdjkLjIAWI1jNOW/zb8/A4NasIMf54mhAPZNQZ3GURoxsP8D6\n\ttqryAGHq5GkFGN56i0LKR2u7RySgcGeH8VRHouCxjPgbJAI9hC1+tU4XQFTAiqlGX/\n\tL4s8nB22fSKhFLtizQOi2YNvNvqokPXMpa/1iXhZkjv/gUA1pQS2c/YK3TIa9zi9n9\n\tBaLW1vDQ+AlcQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1649210162;\n\tbh=d5g+7SAsXf6DQLw5ENNnK2zIXpOL45/pkqFtC/TdvHg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Qv/MFBFZrE7luynMg0sKzrHJhN9yWbAbsCR2+VteGjEtOAiexs1Y62m/BGgjGVR0j\n\tONmwHKTziZaBlpqcJ6eORKy+45Zf1+gWvd3c+LvdVgWJZf/aK7LaL9ziLIZiZcuSZU\n\tp1flnkC0ZWKyjZ4vnUPiSLSrtptyGslGa5xDZ7xw="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"Qv/MFBFZ\"; dkim-atps=neutral","Date":"Wed, 6 Apr 2022 04:55:59 +0300","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Message-ID":"<YkzzL2n7fu6ZRQjD@pendragon.ideasonboard.com>","References":"<20220314154633.506026-1-tomi.valkeinen@ideasonboard.com>\n\t<CAHW6GYLW3rqbd-DHMxtFaqU_ad=-r7ZKzkPB_jxENrUWyO9viw@mail.gmail.com>\n\t<34fdecb6-4a1e-740a-a318-ac1d8ea5f1e3@ideasonboard.com>\n\t<029f59f0-50a0-0da2-eae3-ad97769f5556@ideasonboard.com>\n\t<164751781044.123014.12481344276890139660@Monstersaurus>\n\t<52e4b737-afbe-b2f1-26a1-b2dadeee691a@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<52e4b737-afbe-b2f1-26a1-b2dadeee691a@ideasonboard.com>","Subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","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":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":22684,"web_url":"https://patchwork.libcamera.org/comment/22684/","msgid":"<164983719647.22830.15473726297179284312@Monstersaurus>","date":"2022-04-13T08:06:36","subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2022-04-06 02:55:59)\n> Hi Tomi,\n> \n> On Tue, Apr 05, 2022 at 09:47:16AM +0300, Tomi Valkeinen wrote:\n> > On 17/03/2022 13:50, Kieran Bingham wrote:\n> > > Quoting Tomi Valkeinen (2022-03-17 10:03:25)\n> > >> On 17/03/2022 11:55, Tomi Valkeinen wrote:\n> > >>> On 17/03/2022 11:44, David Plowman wrote:\n> > >>>> Hi everyone\n> > >>>>\n> > >>>> Thanks for the update!\n> > >>>>\n> > >>>> On Mon, 14 Mar 2022 at 15:46, Tomi Valkeinen\n> > >>>> <tomi.valkeinen@ideasonboard.com> wrote:\n> > >>>>>\n> > >>>>> Hi,\n> > >>>>>\n> > >>>>> This is v5 of the series. The changes to v4:\n> > >>>>>\n> > >>>>> - Changed to pybind11 'smart_holders' branch which allows us to drop the\n> > >>>>>     HACK for Camera public destructor\n> > >>>>> - Changed Request.set_control() so that we can drop the HACK for\n> > >>>>>     exposing Camera from Request\n> > >>>>> - Moved Python enum defs to a separate file for clarity\n> > >>>>> - \"Forward\" declare Python classes to fix docstring issues.\n> > >>>>>\n> > >>>>> The set_control change breaks the current users of that function.\n> > >>>>> Previously you could do this:\n> > >>>>>\n> > >>>>> req.set_control(\"Brightness\", 1)\n> > >>>>>\n> > >>>>> Now you need to do:\n> > >>>>>\n> > >>>>> cid = camera.find_control(\"Brightness\")\n> > >>>>> req.set_control(cid, 1)\n> > >>>>>\n> > >>>>\n> > >>>> I see the need for this, and I guess it's fine - obviously we'll hide\n> > >>>> that under our Picamera2 API as we wouldn't want our users to have to\n> > >>>> do that!\n> > >>\n> > >> I think the core question is whether a Request is tied to a Camera. I\n> > >> thought it is, as it is created from the Camera. And if that's the case,\n> > >> I don't see why the Camera cannot be exposed from the Request.\n> > > \n> > > This is how I understand it, and the patch I have/had locally to add and\n> > > expose this is followed by an addition of an error check to make sure\n> > > that requests queued to a camera that were not created by that camera get\n> > > rejected.\n> > > \n> > > I could probably still do that using the private class infrastructure\n> > > now though. (re-sketching up that patch now).\n> > > \n> > >> Maybe Laurent can explain the reasons why not to expose it.\n> > \n> > Any comment on this?\n> \n> Added on my todo list, I'll sleep over that and try to reply before the\n> end of the week.\n\nNote that now I've now merged my \"Ensure requests belong to the camera\"\npatch, so the libcamera API rejects any Request which is not queued\ndirectly to it's camera.\n\nI would believe that makes it 'safe' to obtain the camera directly from\na request, and trust that it's properties are directly associated with\nthe correct camera.\n\n--\nKieran\n\n> -- \n> Regards,\n> \n> Laurent Pinchart","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 B48ABC3256\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 13 Apr 2022 08:06:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1C72565644;\n\tWed, 13 Apr 2022 10:06:40 +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 08D1E604B3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 13 Apr 2022 10:06:39 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8385725B;\n\tWed, 13 Apr 2022 10:06:38 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1649837200;\n\tbh=5/Z+SZVISD1ObLvHDi/9AFfj6jcP4YBrkIxOFARPY7k=;\n\th=In-Reply-To:References:To:Date:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=D3dYGm1lxXcnMIloi/saquCbuX+VOiXI4sOf56rCSrq84Wwd/r/oNfhpe2d7fKhvs\n\tbTx9en2B2LNlwMPI6gLB6rGoIy/YMBFuY9wimmEMNbI224qZlgGAhQ1zu6OQplhJW7\n\trhOnR93tlAIpsqQ7BkeNTntIpy8vr4r36flhDQM0vDVdZmNbGK6NKPu5Bu2ivgUzGb\n\tx4qgNowCddhvZelpyIDqr8UTpGwR76wkNeMo7lPJ5UiEzGwtxn7rtqDQI+Nk5WrxXD\n\t2WRHOqRkMUVorRoZpJLVVDB5KHWgXWjGFj4DZACEVHHlDtn/ngu/Qft1O9/AqFrBzQ\n\tUSF0R0ujiZxQA==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1649837198;\n\tbh=5/Z+SZVISD1ObLvHDi/9AFfj6jcP4YBrkIxOFARPY7k=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=S3ac+X9sA4NGqW2SY6aSw8ejFMXdJAj5hSWA3sZBAoikxmPYJKUXcm1aUxl6xMo1G\n\tX/aupI8Kwlzbmm5wc3M3AkQ16UZG/ixHKyjs29bdlNfOayE8QXHFCvOsjd4YQ2tCMt\n\twhx/16dpRfdUtR/NKwPXl+SOd5Rv3Na/2qAQIAqM="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"S3ac+X9s\"; dkim-atps=neutral","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<YkzzL2n7fu6ZRQjD@pendragon.ideasonboard.com>","References":"<20220314154633.506026-1-tomi.valkeinen@ideasonboard.com>\n\t<CAHW6GYLW3rqbd-DHMxtFaqU_ad=-r7ZKzkPB_jxENrUWyO9viw@mail.gmail.com>\n\t<34fdecb6-4a1e-740a-a318-ac1d8ea5f1e3@ideasonboard.com>\n\t<029f59f0-50a0-0da2-eae3-ad97769f5556@ideasonboard.com>\n\t<164751781044.123014.12481344276890139660@Monstersaurus>\n\t<52e4b737-afbe-b2f1-26a1-b2dadeee691a@ideasonboard.com>\n\t<YkzzL2n7fu6ZRQjD@pendragon.ideasonboard.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tTomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Date":"Wed, 13 Apr 2022 09:06:36 +0100","Message-ID":"<164983719647.22830.15473726297179284312@Monstersaurus>","User-Agent":"alot/0.10","Subject":"Re: [libcamera-devel] [PATCH v5 0/3] Python bindings","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":"Kieran Bingham via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera devel <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]