| 1 |
#include "colmap/scene/point2d.h" |
| 2 |
|
| 3 |
#include "colmap/util/logging.h" |
| 4 |
#include "colmap/util/misc.h" |
| 5 |
#include "colmap/util/types.h" |
| 6 |
|
| 7 |
#include "pycolmap/helpers.h" |
| 8 |
#include "pycolmap/pybind11_extension.h" |
| 9 |
#include "pycolmap/scene/types.h" |
| 10 |
|
| 11 |
#include <pybind11/eigen.h> |
| 12 |
#include <pybind11/pybind11.h> |
| 13 |
#include <pybind11/stl.h> |
| 14 |
#include <pybind11/stl_bind.h> |
| 15 |
|
| 16 |
using namespace colmap; |
| 17 |
using namespace pybind11::literals; |
| 18 |
namespace py = pybind11; |
| 19 |
|
| 20 |
void BindPoint2D(py::module& m) { |
| 21 |
py::classh_ext<Point2D> PyPoint2D(m, "Point2D"); |
| 22 |
PyPoint2D.def(py::init<>()) |
| 23 |
.def(py::init<const Eigen::Vector2d&, size_t>(), |
| 24 |
"xy"_a, |
| 25 |
py::arg_v( |
| 26 |
"point3D_id", kInvalidPoint3DId, "pycolmap.INVALID_POINT3D_ID")) |
| 27 |
.def_readwrite("xy", &Point2D::xy) |
| 28 |
.def("x", [](const Point2D& self) -> double { return self.xy[0]; }) |
| 29 |
.def("y", [](const Point2D& self) -> double { return self.xy[1]; }) |
| 30 |
.def_readwrite("point3D_id", &Point2D::point3D_id) |
| 31 |
.def("has_point3D", &Point2D::HasPoint3D); |
| 32 |
MakeDataclass(PyPoint2D); |
| 33 |
|
| 34 |
py::bind_vector<Point2DVector>(m, "Point2DList"); |
| 35 |
} |