Patch Detail
Show a patch.
GET /api/patches/15968/?format=api
{ "id": 15968, "url": "https://patchwork.libcamera.org/api/patches/15968/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15968/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220518131329.66994-19-tomi.valkeinen@ideasonboard.com>", "date": "2022-05-18T13:13:29", "name": "[libcamera-devel,v3,18/18] py: cam_qt: use libcamera.formats", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": false, "hash": "1433d9fc68ca6f0d2d726e9a5b53df38923e8383", "submitter": { "id": 109, "url": "https://patchwork.libcamera.org/api/people/109/?format=api", "name": "Tomi Valkeinen", "email": "tomi.valkeinen@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/15968/mbox/", "series": [ { "id": 3122, "url": "https://patchwork.libcamera.org/api/series/3122/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3122", "date": "2022-05-18T13:13:11", "name": "Misc Python bindings patches", "version": 3, "mbox": "https://patchwork.libcamera.org/series/3122/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15968/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15968/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 4D826C3276\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 18 May 2022 13:14:12 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D36F465681;\n\tWed, 18 May 2022 15:14:11 +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 9F0336565E\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 18 May 2022 15:13:55 +0200 (CEST)", "from deskari.lan (91-156-85-209.elisa-laajakaista.fi\n\t[91.156.85.209])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 1B9561BBB;\n\tWed, 18 May 2022 15:13:55 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652879651;\n\tbh=Q25Ba4mjLxmvzDleDRORF9gDsRZxtS6O/odB5NQekI4=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=unMtBjAUPUjs6CcP66DUPoeLfmFfVkU3se6cZLaedPnHsyNKd/14uBJVj9WDYPkHE\n\t3DcpAb2PTSc6j85zplsxGWivM89WE7LYFHA8f7vLIiNLvlSRF72zT7xQUsb+6ewjZo\n\t9N4kE7kLPvqxSwOKEm3vm5NWi7Pr/1VIQvYGrvOrGab220yDF8sgXZS1y9zkeQQzzi\n\tGhrJxfecXu6uzEPdPlIwXXzoEWPfoXbVuSkIkvfstj5LN2PVTRKWy24nUwueAf+cpk\n\t66PLdu21/s+6XODC9YVZJwI/y2laFE/7gb2iRTwtp52dzp6Z10+Mo+6TKVnw80+GkE\n\tFkFV9DNx5BHVQ==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1652879635;\n\tbh=Q25Ba4mjLxmvzDleDRORF9gDsRZxtS6O/odB5NQekI4=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=aHlkCN6GWBj5nBEGydA4AjeerLetKbEJIKRhQbl2B7rhoGqe1JcobIrk0lR5ceAHb\n\tKvzRHB3nXBGPS0DUNpLmswBjiNySp18Jn2l0HJwpdZJy10G4ge+m3nytBLIrqW1+lN\n\tini6cHlSYFHsTyn2a6PloxBAsWO2kBRld3u74yhU=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"aHlkCN6G\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org,\n\tDavid Plowman <david.plowman@raspberrypi.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tJacopo Mondi <jacopo@jmondi.org>", "Date": "Wed, 18 May 2022 16:13:29 +0300", "Message-Id": "<20220518131329.66994-19-tomi.valkeinen@ideasonboard.com>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20220518131329.66994-1-tomi.valkeinen@ideasonboard.com>", "References": "<20220518131329.66994-1-tomi.valkeinen@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH v3 18/18] py: cam_qt: use libcamera.formats", "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>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "Use the new libcamera.formats in cam_qt.py.\n\nSigned-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n---\n src/py/cam/cam_qt.py | 17 +++++++++--------\n 1 file changed, 9 insertions(+), 8 deletions(-)", "diff": "diff --git a/src/py/cam/cam_qt.py b/src/py/cam/cam_qt.py\nindex 91be2a08..142bb35e 100644\n--- a/src/py/cam/cam_qt.py\n+++ b/src/py/cam/cam_qt.py\n@@ -8,6 +8,7 @@ from numpy.lib.stride_tricks import as_strided\n from PIL import Image\n from PIL.ImageQt import ImageQt\n from PyQt5 import QtCore, QtGui, QtWidgets\n+import libcamera as libcam\n import numpy as np\n import sys\n \n@@ -87,9 +88,7 @@ def to_rgb(fmt, size, data):\n w = size.width\n h = size.height\n \n- fmt = str(fmt)\n-\n- if fmt == 'YUYV':\n+ if fmt == libcam.formats.YUYV:\n # YUV422\n yuyv = data.reshape((h, w // 2 * 4))\n \n@@ -111,20 +110,22 @@ def to_rgb(fmt, size, data):\n rgb[:, :, 2] -= 226.8183044444304\n rgb = rgb.astype(np.uint8)\n \n- elif fmt == 'RGB888':\n+ elif fmt == libcam.formats.RGB888:\n rgb = data.reshape((h, w, 3))\n rgb[:, :, [0, 1, 2]] = rgb[:, :, [2, 1, 0]]\n \n- elif fmt == 'BGR888':\n+ elif fmt == libcam.formats.BGR888:\n rgb = data.reshape((h, w, 3))\n \n- elif fmt in ['ARGB8888', 'XRGB8888']:\n+ elif fmt in [libcam.formats.ARGB8888, libcam.formats.XRGB8888]:\n rgb = data.reshape((h, w, 4))\n rgb = np.flip(rgb, axis=2)\n # drop alpha component\n rgb = np.delete(rgb, np.s_[0::4], axis=2)\n \n- elif fmt.startswith('S'):\n+ elif str(fmt).startswith('S'):\n+ # \\todo implement PixelFormatInfo and use it here\n+ fmt = str(fmt)\n bayer_pattern = fmt[1:5]\n bitspp = int(fmt[5:])\n \n@@ -296,7 +297,7 @@ class MainWindow(QtWidgets.QWidget):\n h = cfg.size.height\n pitch = cfg.stride\n \n- if str(cfg.pixel_format) == 'MJPEG':\n+ if cfg.pixel_format == libcam.formats.MJPEG:\n img = Image.open(BytesIO(mfb.planes[0]))\n qim = ImageQt(img).copy()\n pix = QtGui.QPixmap.fromImage(qim)\n", "prefixes": [ "libcamera-devel", "v3", "18/18" ] }