Debian Codegraph @

src/pycolmap/main.cc

raw
1 #include "colmap/math/random.h"
2 #include "colmap/util/version.h"
3
4 #include "pycolmap/helpers.h"
5 #include "pycolmap/pybind11_extension.h"
6 #include "pycolmap/utils.h"
7
8 #include <ceres/version.h>
9 #include <pybind11/iostream.h>
10 #include <pybind11/pybind11.h>
11 #include <pybind11/stl.h>
12
13 using namespace colmap;
14 using namespace pybind11::literals;
15 namespace py = pybind11;
16
17 void BindEstimators(py::module& m);
18 void BindFeatureTypes(py::module& m);
19 void BindFeature(py::module& m);
20 void BindGeometry(py::module& m);
21 void BindImage(py::module& m);
22 void BindOptim(py::module& m);
23 void BindPipeline(py::module& m);
24 void BindRetrieval(py::module& m);
25 void BindSceneTypes(py::module& m);
26 void BindScene(py::module& m);
27 void BindSensor(py::module& m);
28 void BindSfm(py::module& m);
29 #if defined(COLMAP_MVS_ENABLED)
30 void BindMvs(py::module& m);
31 #endif
32 void BindUtil(py::module& m);
33
34 PYBIND11_MODULE(_core, m) {
35 m.doc() = "COLMAP plugin";
36 #ifdef VERSION_INFO
37 m.attr("__version__") = py::str(VERSION_INFO);
38 #else
39 m.attr("__version__") = py::str("dev");
40 #endif
41 m.attr("__ceres_version__") = py::str(CERES_VERSION_STRING);
42 m.attr("has_cuda") = IsGPU(Device::AUTO);
43 m.attr("COLMAP_version") = py::str(GetVersionInfo());
44 m.attr("COLMAP_build") = py::str(GetBuildInfo());
45
46 auto PyDevice = py::enum_<Device>(m, "Device")
47 .value("auto", Device::AUTO)
48 .value("cpu", Device::CPU)
49 .value("cuda", Device::CUDA);
50 AddStringToEnumConstructor(PyDevice);
51
52 BindUtil(m);
53 BindGeometry(m);
54 BindOptim(m);
55 BindSensor(m);
56 BindFeatureTypes(m);
57 BindSceneTypes(m);
58 BindFeature(m);
59 BindScene(m);
60 BindImage(m);
61 BindEstimators(m);
62 BindRetrieval(m);
63 BindSfm(m);
64 #if defined(COLMAP_MVS_ENABLED)
65 BindMvs(m);
66 #endif
67 BindPipeline(m);
68
69 m.def("set_random_seed",
70 &SetPRNGSeed,
71 "seed"_a,
72 "Initialize the PRNG with the given seed.");
73
74 py::add_ostream_redirect(m, "ostream");
75 }