Show a patch.

GET /api/patches/26911/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 26911,
    "url": "https://patchwork.libcamera.org/api/patches/26911/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/26911/",
    "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": "<20260617095857.667583-3-stefan.klug@ideasonboard.com>",
    "date": "2026-06-17T09:58:50",
    "name": "[2/2] libcamera: converter: converter_dw100: Allow to transform between different camera matrices",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "931f7b222c960776304705252996bde5dd1a64b2",
    "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/26911/mbox/",
    "series": [
        {
            "id": 6001,
            "url": "https://patchwork.libcamera.org/api/series/6001/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=6001",
            "date": "2026-06-17T09:58:48",
            "name": "Add cmNew to dewarp paremeters",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/6001/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/26911/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/26911/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 E13F3BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 17 Jun 2026 09:59:09 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8CA866289A;\n\tWed, 17 Jun 2026 11:59:09 +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 1583562886\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 17 Jun 2026 11:59:08 +0200 (CEST)",
            "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:bba7:89ad:1437:cbea])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id EEED397F;\n\tWed, 17 Jun 2026 11:58: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=\"ULl+NJod\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1781690314;\n\tbh=/7yCmiMb9P+Gw1Nx0CCveA5uU/i8ed4pbSKg6BYXfao=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=ULl+NJodxWECuY8dGd3gD0SX3ZyBBBarg31u79EELq3vIUPw+mckhLeBbUWFpIIly\n\t1qpmH2xR/isIGwdxf5IV8LFkDoevgi2ICPJZL/1J2ymn9joZLNTS0HLzduf4W0KHl2\n\t+NBmEorh7arxjwvhddvk3xkXGEaO/9Dul8pzVdc8=",
        "From": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>",
        "Subject": "[PATCH 2/2] libcamera: converter: converter_dw100: Allow to\n\ttransform between different camera matrices",
        "Date": "Wed, 17 Jun 2026 11:58:50 +0200",
        "Message-ID": "<20260617095857.667583-3-stefan.klug@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.53.0",
        "In-Reply-To": "<20260617095857.667583-1-stefan.klug@ideasonboard.com>",
        "References": "<20260617095857.667583-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 787498c7fdb5..d60997f56ad5 100644\n--- a/include/libcamera/internal/converter/converter_dw100_vertexmap.h\n+++ b/include/libcamera/internal/converter/converter_dw100_vertexmap.h\n@@ -33,11 +33,13 @@ 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 \n \t\tMatrix<double, 3, 3> cm;\n+\t\tMatrix<double, 3, 3> cmNew;\n \n \t\tunion {\n \t\t\tstruct {\ndiff --git a/src/libcamera/converter/converter_dw100.cpp b/src/libcamera/converter/converter_dw100.cpp\nindex 34f81c6b9fab..97a025b7f961 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 &params)\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@@ -142,6 +143,18 @@ int ConverterDW100Module::init(const ValueNode &params)\n \n \tstd::copy(coeffs->begin(), coeffs->end(), &dp.coefficients[0]);\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 31d992546857..22e08656d36d 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::coefficient\n  * \\brief Structure containing the lens dewarp coefficients\n \n@@ -619,10 +622,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_->coefficient;\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": [
        "2/2"
    ]
}