Debian Codegraph @

src/pycolmap/scene/two_view_geometry.cc

raw
1 #include "colmap/scene/two_view_geometry.h"
2
3 #include "colmap/feature/types.h"
4 #include "colmap/scene/camera.h"
5
6 #include "pycolmap/helpers.h"
7 #include "pycolmap/pybind11_extension.h"
8 #include "pycolmap/utils.h"
9
10 #include <pybind11/eigen.h>
11 #include <pybind11/pybind11.h>
12 #include <pybind11/stl.h>
13 #include <pybind11/stl_bind.h>
14
15 using namespace colmap;
16 using namespace pybind11::literals;
17 namespace py = pybind11;
18
19 void BindTwoViewGeometryScene(py::module& m) {
20 py::enum_<TwoViewGeometry::ConfigurationType> PyTwoViewGeometryConfiguration(
21 m, "TwoViewGeometryConfiguration");
22 PyTwoViewGeometryConfiguration.value("UNDEFINED", TwoViewGeometry::UNDEFINED)
23 .value("DEGENERATE", TwoViewGeometry::DEGENERATE)
24 .value("CALIBRATED", TwoViewGeometry::CALIBRATED)
25 .value("CALIBRATED_RIG", TwoViewGeometry::CALIBRATED_RIG)
26 .value("UNCALIBRATED", TwoViewGeometry::UNCALIBRATED)
27 .value("PLANAR", TwoViewGeometry::PLANAR)
28 .value("PANORAMIC", TwoViewGeometry::PANORAMIC)
29 .value("PLANAR_OR_PANORAMIC", TwoViewGeometry::PLANAR_OR_PANORAMIC)
30 .value("WATERMARK", TwoViewGeometry::WATERMARK)
31 .value("MULTIPLE", TwoViewGeometry::MULTIPLE);
32 AddStringToEnumConstructor(PyTwoViewGeometryConfiguration);
33
34 py::classh<TwoViewGeometry> PyTwoViewGeometry(m, "TwoViewGeometry");
35 PyTwoViewGeometry.def(py::init<>())
36 .def_readwrite("config", &TwoViewGeometry::config)
37 .def_readwrite("E", &TwoViewGeometry::E)
38 .def_readwrite("F", &TwoViewGeometry::F)
39 .def_readwrite("H", &TwoViewGeometry::H)
40 .def_readwrite("cam2_from_cam1", &TwoViewGeometry::cam2_from_cam1)
41 .def_readwrite("camera1", &TwoViewGeometry::camera1)
42 .def_readwrite("camera2", &TwoViewGeometry::camera2)
43 .def_property(
44 "inlier_matches",
45 [](const TwoViewGeometry& self) {
46 return MatchesToMatrix(self.inlier_matches);
47 },
48 [](TwoViewGeometry& self,
49 const Eigen::Ref<const FeatureMatchesMatrix>& matrix) {
50 self.inlier_matches = MatchesFromMatrix(matrix);
51 })
52 .def_readwrite("tri_angle", &TwoViewGeometry::tri_angle)
53 .def("invert", &TwoViewGeometry::Invert);
54 MakeDataclass(PyTwoViewGeometry);
55 }