forked from colmap/pycolmap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cc
61 lines (51 loc) · 2.23 KB
/
main.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <pybind11/pybind11.h>
namespace py = pybind11;
#include "absolute_pose.cc"
#include "generalized_absolute_pose.cc"
#include "essential_matrix.cc"
#include "fundamental_matrix.cc"
#include "transformations.cc"
#include "sift.cc"
#include "pose_refinement.cc"
PYBIND11_MODULE(pycolmap, m) {
m.doc() = "COLMAP plugin";
// Absolute pose.
m.def("absolute_pose_estimation", &absolute_pose_estimation,
py::arg("points2D"), py::arg("points3D"),
py::arg("camera_dict"),
py::arg("max_error_px") = 12.0,
"Absolute pose estimation with non-linear refinement.");
m.def("rig_absolute_pose_estimation", &rig_absolute_pose_estimation,
py::arg("points2D"), py::arg("points3D"),
py::arg("camera_dicts"),
py::arg("rig_qvecs"), py::arg("rig_tvecs"),
py::arg("max_error_px") = 12.0,
"Absolute pose estimation of a multi-camera rig.");
// Essential matrix.
m.def("essential_matrix_estimation", &essential_matrix_estimation,
py::arg("points2D1"), py::arg("points2D2"),
py::arg("camera_dict1"), py::arg("camera_dict2"),
py::arg("max_error_px") = 4.0,
"LORANSAC + 5-point algorithm.");
// Fundamental matrix.
m.def("fundamental_matrix_estimation", &fundamental_matrix_estimation,
py::arg("points2D1"), py::arg("points2D2"),
py::arg("max_error_px") = 4.0,
"LORANSAC + 7-point algorithm.");
// Image-to-world and world-to-image.
m.def("image_to_world", &image_to_world, "Image to world transformation.");
m.def("world_to_image", &world_to_image, "World to image transformation.");
// SIFT.
m.def("extract_sift", &extract_sift,
py::arg("image"),
py::arg("num_octaves") = 4, py::arg("octave_resolution") = 3, py::arg("first_octave") = 0,
py::arg("edge_thresh") = 10.0, py::arg("peak_thresh") = 0.01, py::arg("upright") = false,
"Extract SIFT features.");
// Standalone Pose Refinement
m.def("pose_refinement", &pose_refinement,
py::arg("tvec"), py::arg("qvec"),
py::arg("points2D"), py::arg("points3D"),
py::arg("inlier_mask"),
py::arg("camera_dict"),
"Non-linear refinement.");
}