MCPcopy Create free account
hub / github.com/colmap/colmap / BindPoseGraph

Function BindPoseGraph

src/pycolmap/scene/pose_graph.cc:15–120  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13namespace py = pybind11;
14
15void BindPoseGraph(py::module& m) {
16 auto PyPoseGraphEdge =
17 py::classh<PoseGraph::Edge>(m, "PoseGraphEdge")
18 .def(py::init<>())
19 .def(py::init<const Rigid3d&>(), "cam2_from_cam1"_a)
20 .def_readwrite("cam2_from_cam1",
21 &PoseGraph::Edge::cam2_from_cam1,
22 "Relative pose from image 1 to image 2.")
23 .def_readwrite("num_matches",
24 &PoseGraph::Edge::num_matches,
25 "Number of two-view matches used to compute the "
26 "relative pose.")
27 .def_readwrite("valid",
28 &PoseGraph::Edge::valid,
29 "Whether this edge is valid for reconstruction.")
30 .def("invert",
31 &PoseGraph::Edge::Invert,
32 "Invert the geometry to match swapped image order.");
33 MakeDataclass(PyPoseGraphEdge);
34
35 py::bind_map<PoseGraphEdgeMap>(m, "PoseGraphEdgeMap");
36
37 py::classh<PoseGraph>(m, "PoseGraph")
38 .def(py::init<>())
39 .def_property_readonly("edges",
40 py::overload_cast<>(&PoseGraph::Edges),
41 py::return_value_policy::reference_internal,
42 "Access to all edges in the pose graph.")
43 .def_property_readonly("num_edges",
44 &PoseGraph::NumEdges,
45 "Number of edges in the pose graph.")
46 .def_property_readonly(
47 "empty", &PoseGraph::Empty, "Whether the pose graph has no edges.")
48 .def("clear", &PoseGraph::Clear, "Remove all edges.")
49 .def("load",
50 &PoseGraph::Load,
51 "corr_graph"_a,
52 "Load edges from a correspondence graph.")
53 .def("add_edge",
54 &PoseGraph::AddEdge,
55 "image_id1"_a,
56 "image_id2"_a,
57 "edge"_a,
58 py::return_value_policy::reference_internal,
59 "Add a new edge between two images. Throws if edge already exists.")
60 .def("has_edge",
61 &PoseGraph::HasEdge,
62 "image_id1"_a,
63 "image_id2"_a,
64 "Check if an edge exists between two images.")
65 .def("get_edge",
66 &PoseGraph::GetEdge,
67 "image_id1"_a,
68 "image_id2"_a,
69 "Get a copy of the edge between two images. Automatically handles "
70 "geometric inversion if image order was swapped.")
71 .def("delete_edge",
72 &PoseGraph::DeleteEdge,

Callers 1

BindSceneFunction · 0.85

Calls 2

MakeDataclassFunction · 0.85

Tested by

no test coverage detected