Patch Detail
Show a patch.
GET /api/patches/26914/?format=api
{ "id": 26914, "url": "https://patchwork.libcamera.org/api/patches/26914/?format=api", "web_url": "https://patchwork.libcamera.org/patch/26914/", "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": "<20260617144858.754729-3-stefan.klug@ideasonboard.com>", "date": "2026-06-17T14:48:35", "name": "[v2,2/2] libcamera: converter: converter_dw100: Allow to transform between different camera matrices", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "8435734a836a6e7fdb0319651d27d5fde88c3073", "submitter": { "id": 184, "url": "https://patchwork.libcamera.org/api/people/184/?format=api", "name": "Stefan Klug", "email": "stefan.klug@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/26914/mbox/", "series": [ { "id": 6002, "url": "https://patchwork.libcamera.org/api/series/6002/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6002", "date": "2026-06-17T14:48:33", "name": "Add cmNew to dewarp paremeters", "version": 2, "mbox": "https://patchwork.libcamera.org/series/6002/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/26914/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/26914/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 CE6D8C328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 17 Jun 2026 14:49:11 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6C98162981;\n\tWed, 17 Jun 2026 16:49:10 +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 0BFB262886\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Jun 2026 16:49:08 +0200 (CEST)", "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:b0bc:b9b5:573f:6fae])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C303B97F;\n\tWed, 17 Jun 2026 16:48:33 +0200 (CEST)" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"VsESOGJm\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1781707713;\n\tbh=Hpk6YefqRwA7rLhHCtWgZqod5EO2e2PENesgbR1a/8k=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=VsESOGJmh70TPKVLuxBq3K7NE/gSlwZ413w+A5gqK/es2oVvu3MGf1VvWqkpn6hT7\n\t6vX1lcTKSoJ8RpVg+W41nEB/YS3qyBOuOwUSaWuMU652F0TR/t/gB7Z2sqDCmeNjTL\n\te9t1pZdGZo4vCPCMT/kgiMr9ss5uwxLbZxih2Cz0=", "From": "Stefan Klug <stefan.klug@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>", "Subject": "[PATCH v2 2/2] libcamera: converter: converter_dw100: Allow to\n\ttransform between different camera matrices", "Date": "Wed, 17 Jun 2026 16:48:35 +0200", "Message-ID": "<20260617144858.754729-3-stefan.klug@ideasonboard.com>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260617144858.754729-1-stefan.klug@ideasonboard.com>", "References": "<20260617144858.754729-1-stefan.klug@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "For some use cases (like removing a skew introduced by the camera\ngeometry) it is necessary to define the output camera matrix. Add that\nfunctionality by adding an optional tuning parameter \"cmNew\" to the\nDewarp configuration. If that parameter is not provided, cm is used\ninstead.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\n---\n\nChanges in v0.2:\n- Swapped cm and cmNew in the output calculation\n---\n .../converter/converter_dw100_vertexmap.h | 2 ++\n src/libcamera/converter/converter_dw100.cpp | 15 ++++++++++++++-\n .../converter/converter_dw100_vertexmap.cpp | 8 ++++++--\n 3 files changed, 22 insertions(+), 3 deletions(-)", "diff": "diff --git a/include/libcamera/internal/converter/converter_dw100_vertexmap.h b/include/libcamera/internal/converter/converter_dw100_vertexmap.h\nindex 6b6f3bae9f50..185cdb7a5cd6 100644\n--- a/include/libcamera/internal/converter/converter_dw100_vertexmap.h\n+++ b/include/libcamera/internal/converter/converter_dw100_vertexmap.h\n@@ -33,6 +33,7 @@ public:\n \n \tstruct DewarpParams {\n \t\tDewarpParams() : cm(Matrix<double, 3, 3>::identity()),\n+\t\t\t\t cmNew(Matrix<double, 3, 3>::identity()),\n \t\t\t\t coefficients({})\n \t\t{\n \t\t}\n@@ -40,6 +41,7 @@ public:\n \t\tint setCoefficients(Span<const double> coeffs);\n \n \t\tMatrix<double, 3, 3> cm;\n+\t\tMatrix<double, 3, 3> cmNew;\n \n \t\tstruct {\n \t\t\tdouble k1;\ndiff --git a/src/libcamera/converter/converter_dw100.cpp b/src/libcamera/converter/converter_dw100.cpp\nindex d05823fa4d4c..77f778c7f103 100644\n--- a/src/libcamera/converter/converter_dw100.cpp\n+++ b/src/libcamera/converter/converter_dw100.cpp\n@@ -104,9 +104,10 @@ int ConverterDW100Module::init(const ValueNode ¶ms)\n \n \tauto &cm = params[\"cm\"];\n \tauto &coefficients = params[\"coefficients\"];\n+\tauto &cmNew = params[\"cmNew\"];\n \n \t/* If nothing is provided, the dewarper is still functional */\n-\tif (!cm && !coefficients)\n+\tif (!cm && !coefficients && !cmNew)\n \t\treturn 0;\n \n \tif (!cm) {\n@@ -140,6 +141,18 @@ int ConverterDW100Module::init(const ValueNode ¶ms)\n \t\treturn -EINVAL;\n \t}\n \n+\tif (cmNew) {\n+\t\tmatrix = cmNew.get<Matrix<double, 3, 3>>();\n+\t\tif (!matrix) {\n+\t\t\tLOG(Converter, Error) << \"Failed to load 'cmNew' value\";\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tdp.cmNew = *matrix;\n+\t} else {\n+\t\tdp.cmNew = dp.cm;\n+\t}\n+\n \tdewarpParams_ = dp;\n \n \treturn 0;\ndiff --git a/src/libcamera/converter/converter_dw100_vertexmap.cpp b/src/libcamera/converter/converter_dw100_vertexmap.cpp\nindex 6986f137cbc8..48f74885297f 100644\n--- a/src/libcamera/converter/converter_dw100_vertexmap.cpp\n+++ b/src/libcamera/converter/converter_dw100_vertexmap.cpp\n@@ -234,6 +234,9 @@ int dw100VerticesForLength(const int length)\n * \\var Dw100VertexMap::DewarpParams::cm\n * \\brief The camera matrix\n *\n+ * \\var Dw100VertexMap::DewarpParams::cmNew\n+ * \\brief The new camera matrix after dewarping\n+ *\n * \\var Dw100VertexMap::DewarpParams::coefficients\n * \\brief Structure containing the lens dewarp coefficients\n \n@@ -664,10 +667,11 @@ Vector2d Dw100VertexMap::dewarpPoint(const Vector2d &p)\n \tdouble x, y;\n \tdouble xout, yout;\n \tauto &cm = dewarpParams_->cm;\n+\tauto &cmNew = dewarpParams_->cmNew;\n \tauto &c = dewarpParams_->coefficients;\n \n-\ty = (p.y() - cm[1][2]) / cm[1][1];\n-\tx = (p.x() - cm[0][2] - y * cm[0][1]) / cm[0][0];\n+\ty = (p.y() - cmNew[1][2]) / cmNew[1][1];\n+\tx = (p.x() - cmNew[0][2] - y * cmNew[0][1]) / cmNew[0][0];\n \n \tdouble r2 = x * x + y * y;\n \tdouble r4 = r2 * r2;\n", "prefixes": [ "v2", "2/2" ] }