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

Function BindFrame

src/pycolmap/scene/frame.cc:20–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18namespace py = pybind11;
19
20void BindFrame(py::module& m) {
21 py::classh<Frame> PyFrame(m, "Frame");
22 PyFrame.def(py::init<>())
23 .def_property("frame_id",
24 &Frame::FrameId,
25 &Frame::SetFrameId,
26 "Unique identifier of the frame.")
27 .def_property("rig_id",
28 &Frame::RigId,
29 &Frame::SetRigId,
30 "Unique identifier of the rig.")
31 .def("has_rig_id", &Frame::HasRigId, "Check whether the rig_id is set.")
32 .def("add_data_id", &Frame::AddDataId, "Associate data with frame.")
33 .def("num_data_ids",
34 &Frame::NumDataIds,
35 "Number of associated data items in frame.")
36 .def("has_data",
37 &Frame::HasDataId,
38 "Check whether frame has associated data.")
39 .def("clear_data_ids",
40 &Frame::ClearDataIds,
41 "Clear all the associated data.")
42 .def("finalize_data_ids",
43 &Frame::FinalizeDataIds,
44 "Finalize data ids, preventing further modifications.")
45 .def("has_final_data_ids",
46 &Frame::HasFinalDataIds,
47 "Check whether data ids have been finalized.")
48 .def_property_readonly(
49 "data_ids",
50 [](const Frame& self) { return self.DataIds(); },
51 "The associated data.")
52 // Cannot have the same name as the property "data_ids" above due to
53 // pybind11 limitations.
54 .def(
55 "data_ids_by_sensor",
56 [](const Frame& self, SensorType type) {
57 const auto data_ids = self.DataIds(type);
58 return std::vector<data_t>(data_ids.begin(), data_ids.end());
59 },
60 "type"_a,
61 "The associated data for a given sensor type.")
62 .def_property_readonly(
63 "image_ids",
64 [](const Frame& self) {
65 const auto image_ids = self.ImageIds();
66 return std::vector<data_t>(image_ids.begin(), image_ids.end());
67 },
68 "The associated image data.")
69 .def_property(
70 "rig",
71 [](Frame& self) -> py::typing::Optional<Rig> {
72 if (self.HasRigPtr()) {
73 return py::cast(self.RigPtr());
74 } else {
75 return py::none();
76 }
77 },

Callers 1

BindSceneTypesFunction · 0.85

Calls 7

MakeDataclassFunction · 0.85
DataIdsMethod · 0.80
ImageIdsMethod · 0.80
HasRigPtrMethod · 0.80
RigPtrMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected