| 62 | } // namespace |
| 63 | |
| 64 | void BindBundleAdjuster(py::module& m) { |
| 65 | IsPyceresAvailable(); // Try to import pyceres to populate the docstrings. |
| 66 | |
| 67 | auto PyBundleAdjustmentTerminationType = |
| 68 | py::enum_<BundleAdjustmentTerminationType>( |
| 69 | m, "BundleAdjustmentTerminationType") |
| 70 | .value("CONVERGENCE", BundleAdjustmentTerminationType::CONVERGENCE) |
| 71 | .value("NO_CONVERGENCE", |
| 72 | BundleAdjustmentTerminationType::NO_CONVERGENCE) |
| 73 | .value("FAILURE", BundleAdjustmentTerminationType::FAILURE) |
| 74 | .value("USER_SUCCESS", BundleAdjustmentTerminationType::USER_SUCCESS) |
| 75 | .value("USER_FAILURE", BundleAdjustmentTerminationType::USER_FAILURE); |
| 76 | AddStringToEnumConstructor(PyBundleAdjustmentTerminationType); |
| 77 | |
| 78 | using BASummary = BundleAdjustmentSummary; |
| 79 | auto PyBundleAdjustmentSummary = |
| 80 | py::classh<BASummary>(m, "BundleAdjustmentSummary") |
| 81 | .def(py::init<>()) |
| 82 | .def_readwrite("termination_type", &BASummary::termination_type) |
| 83 | .def_readwrite("num_residuals", &BASummary::num_residuals) |
| 84 | .def("is_solution_usable", &BASummary::IsSolutionUsable) |
| 85 | .def("brief_report", &BASummary::BriefReport); |
| 86 | MakeDataclass(PyBundleAdjustmentSummary); |
| 87 | |
| 88 | using CeresBASummary = CeresBundleAdjustmentSummary; |
| 89 | auto PyCeresBundleAdjustmentSummary = |
| 90 | py::classh<CeresBASummary, BASummary>(m, "CeresBundleAdjustmentSummary") |
| 91 | .def(py::init<>()) |
| 92 | .def_readwrite("ceres_summary", |
| 93 | &CeresBASummary::ceres_summary, |
| 94 | "Full Ceres solver summary."); |
| 95 | MakeDataclass(PyCeresBundleAdjustmentSummary); |
| 96 | |
| 97 | #ifdef CASPAR_ENABLED |
| 98 | using CasparBASummary = CasparBundleAdjustmentSummary; |
| 99 | auto PyCasparBundleAdjustmentSummary = |
| 100 | py::classh<CasparBASummary, BASummary>(m, "CasparBundleAdjustmentSummary") |
| 101 | .def(py::init<>()); |
| 102 | MakeDataclass(PyCasparBundleAdjustmentSummary); |
| 103 | #endif |
| 104 | |
| 105 | auto PyBundleAdjustmentGauge = |
| 106 | py::enum_<BundleAdjustmentGauge>(m, "BundleAdjustmentGauge") |
| 107 | .value("UNSPECIFIED", BundleAdjustmentGauge::UNSPECIFIED) |
| 108 | .value("TWO_CAMS_FROM_WORLD", |
| 109 | BundleAdjustmentGauge::TWO_CAMS_FROM_WORLD) |
| 110 | .value("THREE_POINTS", BundleAdjustmentGauge::THREE_POINTS); |
| 111 | AddStringToEnumConstructor(PyBundleAdjustmentGauge); |
| 112 | |
| 113 | auto PyBundleAdjustmentBackend = |
| 114 | py::enum_<BundleAdjustmentBackend>(m, "BundleAdjustmentBackend") |
| 115 | .value("CERES", BundleAdjustmentBackend::CERES) |
| 116 | .value("CASPAR", BundleAdjustmentBackend::CASPAR); |
| 117 | AddStringToEnumConstructor(PyBundleAdjustmentBackend); |
| 118 | |
| 119 | using BACfg = BundleAdjustmentConfig; |
| 120 | py::classh<BACfg> PyBundleAdjustmentConfig(m, "BundleAdjustmentConfig"); |
| 121 | PyBundleAdjustmentConfig.def(py::init<>()) |
no test coverage detected