| 1 |
#include "colmap/scene/rig.h" |
| 2 |
|
| 3 |
#include "pycolmap/helpers.h" |
| 4 |
#include "pycolmap/pybind11_extension.h" |
| 5 |
#include "pycolmap/scene/types.h" |
| 6 |
|
| 7 |
#include <memory> |
| 8 |
|
| 9 |
#include <pybind11/pybind11.h> |
| 10 |
#include <pybind11/stl.h> |
| 11 |
|
| 12 |
using namespace colmap; |
| 13 |
namespace py = pybind11; |
| 14 |
using namespace pybind11::literals; |
| 15 |
|
| 16 |
void BindSceneRig(py::module& m) { |
| 17 |
py::classh_ext<RigConfig::RigCamera> PyRigConfigCamera(m, "RigConfigCamera"); |
| 18 |
PyRigConfigCamera.def(py::init<>()) |
| 19 |
.def_readwrite("ref_sensor", &RigConfig::RigCamera::ref_sensor) |
| 20 |
.def_readwrite("image_prefix", &RigConfig::RigCamera::image_prefix) |
| 21 |
.def_readwrite("cam_from_rig", &RigConfig::RigCamera::cam_from_rig) |
| 22 |
.def_readwrite("camera", &RigConfig::RigCamera::camera); |
| 23 |
MakeDataclass(PyRigConfigCamera); |
| 24 |
|
| 25 |
py::classh_ext<RigConfig> PyRigConfig(m, "RigConfig"); |
| 26 |
PyRigConfig.def(py::init<>()).def_readwrite("cameras", &RigConfig::cameras); |
| 27 |
MakeDataclass(PyRigConfig); |
| 28 |
|
| 29 |
m.def("read_rig_config", |
| 30 |
&ReadRigConfig, |
| 31 |
"path"_a, |
| 32 |
"Read the rig configuration from a .json file. Rotations are expected " |
| 33 |
"in the order [w, x, y, z]."); |
| 34 |
m.def("apply_rig_config", |
| 35 |
&ApplyRigConfig, |
| 36 |
"configs"_a, |
| 37 |
"database"_a, |
| 38 |
"reconstruction"_a = py::none(), |
| 39 |
"Applies the given rig configuration to the database and optionally " |
| 40 |
"derives camera rig extrinsics and intrinsics from the reconstruction, " |
| 41 |
"if not defined in the config. If the reconstruction is provided, it " |
| 42 |
"is also updated with the provided config and any previous rigs/frames " |
| 43 |
"are cleared and overwritten."); |
| 44 |
} |