Debian Codegraph @

src/pycolmap/util/types.cc

raw
1 #include "colmap/feature/types.h"
2
3 #include "pycolmap/helpers.h"
4 #include "pycolmap/pybind11_extension.h"
5
6 #include <pybind11/eigen.h>
7 #include <pybind11/pybind11.h>
8 #include <pybind11/stl.h>
9
10 using namespace colmap;
11 using namespace pybind11::literals;
12 namespace py = pybind11;
13
14 void BindUtilTypes(py::module& m) {
15 auto PySensorType = py::enum_<SensorType>(m, "SensorType")
16 .value("INVALID", SensorType::INVALID)
17 .value("CAMERA", SensorType::CAMERA)
18 .value("IMU", SensorType::IMU);
19 AddStringToEnumConstructor(PySensorType);
20
21 auto PySensorT = py::classh<sensor_t>(m, "sensor_t")
22 .def(py::init<>())
23 .def(py::init<SensorType, uint32_t>(), "type"_a, "id"_a)
24 .def_readwrite("type", &sensor_t::type)
25 .def_readwrite("id", &sensor_t::id);
26 MakeDataclass(PySensorT);
27
28 auto PyDataT = py::classh<data_t>(m, "data_t")
29 .def(py::init<>())
30 .def(py::init<sensor_t, uint32_t>(), "sensor_id"_a, "id"_a)
31 .def_readwrite("sensor_id", &data_t::sensor_id)
32 .def_readwrite("id", &data_t::id);
33 MakeDataclass(PyDataT);
34
35 m.def("image_pair_to_pair_id",
36 &ImagePairToPairId,
37 "image_id1"_a,
38 "image_id2"_a);
39 m.def("pair_id_to_image_pair", &PairIdToImagePair, "pair_id"_a);
40 m.def("should_swap_image_pair",
41 &ShouldSwapImagePair,
42 "image_id1"_a,
43 "image_id2"_a);
44 }