From b3b9e5a2475c97ff334237a24ddaffa238a4c0a3 Mon Sep 17 00:00:00 2001 From: Paul-Edouard Sarlin Date: Thu, 25 Jan 2024 17:33:13 +0100 Subject: [PATCH 1/2] Overload img_from_cam for 3D points --- pycolmap/scene/camera.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pycolmap/scene/camera.h b/pycolmap/scene/camera.h index 3eab552..8f5b0c6 100644 --- a/pycolmap/scene/camera.h +++ b/pycolmap/scene/camera.h @@ -176,6 +176,15 @@ void BindCamera(py::module& m) { return image_points; }, "Project list of points from world / infinity to image plane.") + .def( + "img_from_cam", + [](const Camera& self, + const py::EigenDRef& world_points) { + return py::cast(self) + .attr("img_from_cam") + .call(world_points.rowwise().hnormalized()); + }, + "Project list of points from world / infinity to image plane.") .def( "img_from_cam", [](const Camera& self, const std::vector& world_points) { From cacd37f0160154778a87e75b5f8977331e3a4d30 Mon Sep 17 00:00:00 2001 From: Paul-Edouard Sarlin Date: Thu, 25 Jan 2024 18:04:21 +0100 Subject: [PATCH 2/2] Call is unnencessary --- pycolmap/scene/camera.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pycolmap/scene/camera.h b/pycolmap/scene/camera.h index 8f5b0c6..d682d3c 100644 --- a/pycolmap/scene/camera.h +++ b/pycolmap/scene/camera.h @@ -180,9 +180,8 @@ void BindCamera(py::module& m) { "img_from_cam", [](const Camera& self, const py::EigenDRef& world_points) { - return py::cast(self) - .attr("img_from_cam") - .call(world_points.rowwise().hnormalized()); + return py::cast(self).attr("img_from_cam")( + world_points.rowwise().hnormalized()); }, "Project list of points from world / infinity to image plane.") .def(