| 19 | namespace py = pybind11; |
| 20 | |
| 21 | void BindAlignmentEstimator(py::module& m) { |
| 22 | py::classh<ImageAlignmentError>(m, "ImageAlignmentError") |
| 23 | .def(py::init<>()) |
| 24 | .def_readwrite("image_name", &ImageAlignmentError::image_name) |
| 25 | .def_readwrite("rotation_error_deg", |
| 26 | &ImageAlignmentError::rotation_error_deg) |
| 27 | .def_readwrite("proj_center_error", |
| 28 | &ImageAlignmentError::proj_center_error); |
| 29 | |
| 30 | m.def( |
| 31 | "align_reconstructions_via_reprojections", |
| 32 | [](const Reconstruction& src_reconstruction, |
| 33 | const Reconstruction& tgt_reconstruction, |
| 34 | const double min_inlier_observations, |
| 35 | const double max_reproj_error) -> py::typing::Optional<Sim3d> { |
| 36 | Sim3d tgt_from_src; |
| 37 | if (!AlignReconstructionsViaReprojections(src_reconstruction, |
| 38 | tgt_reconstruction, |
| 39 | min_inlier_observations, |
| 40 | max_reproj_error, |
| 41 | &tgt_from_src)) { |
| 42 | return py::none(); |
| 43 | } |
| 44 | return py::cast(tgt_from_src); |
| 45 | }, |
| 46 | "src_reconstruction"_a, |
| 47 | "tgt_reconstruction"_a, |
| 48 | "min_inlier_observations"_a = 0.3, |
| 49 | "max_reproj_error"_a = 8.0); |
| 50 | |
| 51 | m.def( |
| 52 | "align_reconstructions_via_proj_centers", |
| 53 | [](const Reconstruction& src_reconstruction, |
| 54 | const Reconstruction& tgt_reconstruction, |
| 55 | const double max_proj_center_error) -> py::typing::Optional<Sim3d> { |
| 56 | Sim3d tgt_from_src; |
| 57 | if (!AlignReconstructionsViaProjCenters(src_reconstruction, |
| 58 | tgt_reconstruction, |
| 59 | max_proj_center_error, |
| 60 | &tgt_from_src)) { |
| 61 | return py::none(); |
| 62 | } |
| 63 | return py::cast(tgt_from_src); |
| 64 | }, |
| 65 | "src_reconstruction"_a, |
| 66 | "tgt_reconstruction"_a, |
| 67 | "max_proj_center_error"_a); |
| 68 | |
| 69 | m.def( |
| 70 | "align_reconstructions_via_points", |
| 71 | [](const Reconstruction& src_reconstruction, |
| 72 | const Reconstruction& tgt_reconstruction, |
| 73 | const size_t min_common_observations, |
| 74 | const double max_error, |
| 75 | const double min_inlier_ratio) -> py::typing::Optional<Sim3d> { |
| 76 | Sim3d tgt_from_src; |
| 77 | if (!AlignReconstructionsViaPoints(src_reconstruction, |
| 78 | tgt_reconstruction, |
no test coverage detected