10 #include "pipelines/sfm.h"
15 namespace reconstruction {
20 static const std::unordered_map<std::string, std::string>
23 "Path to database in which to store the extracted data"},
25 "The path to the workspace folder in which all results are "
28 "The path to the image folder which are used as input."},
30 "The path to the mask folder which are used as input."},
32 "The path to the vocabulary tree for feature matching."},
34 "Supported data types are {individual, video, internet}."},
36 "Supported quality types are {low, medium, high, extreme}."},
37 {
"camera_model",
"Which camera model to use for images."},
38 {
"single_camera",
"Whether to use shared intrinsics or not."},
39 {
"sparse",
"Whether to perform sparse mapping."},
40 {
"dense",
"Whether to perform dense mapping."},
42 "Supported meshing algorithm types are {poisson, delaunay}."},
43 {
"num_threads",
"The number of threads to use in all stages."},
45 "Whether to use the GPU in feature extraction and matching."},
47 "Index of the GPU used for GPU stages. For multi-GPU "
48 "computation, you should separate multiple GPU indices by "
49 "comma, e.g., ``0,1,2,3``. By default, all GPUs will be used "
52 "The input path containing cameras.bin/txt, images.bin/txt "
53 "and points3D.bin/txt."},
55 "The output path containing target cameras.bin/txt, "
56 "images.bin/txt and points3D.bin/txt."},
58 "A text file path containing image file path."},
60 "The number of workers used to reconstruct clusters in "
63 "The number of overlapping images between child clusters."},
64 {
"leaf_max_num_images",
65 "The maximum number of images in a leaf node cluster, "
66 "otherwise the cluster is further partitioned using the given "
68 "Note that a cluster leaf node will have at most "
69 "`leaf_max_num_images + overlap` images to satisfy the "
70 "overlap constraint."},
71 {
"min_track_len",
"The minimum track length."},
72 {
"max_reproj_error",
"The maximum re-projection error."},
73 {
"min_tri_angle",
"The minimum tri angle."},
75 "Whether to clear all existing points and observations."},
76 {
"rig_config_path",
"The rig config path."},
77 {
"estimate_rig_relative_poses",
78 "Whether to estimate rig relative poses."},
79 {
"refine_relative_poses",
80 "Whether to optimize the relative poses of the camera "
84 m.def(
"auto_reconstruction", &AutomaticReconstruct,
85 py::call_guard<py::gil_scoped_release>(),
86 "Function for the automatic reconstruction",
"workspace_path"_a,
87 "image_path"_a,
"mask_path"_a =
"",
"vocab_tree_path"_a =
"",
88 "data_type"_a =
"individual",
"quality"_a =
"high",
89 "mesher"_a =
"poisson",
"camera_model"_a =
"SIMPLE_RADIAL",
90 "single_camera"_a =
false,
"sparse"_a =
true,
"dense"_a =
true,
91 "num_threads"_a = -1,
"use_gpu"_a =
true,
"gpu_index"_a =
"-1");
95 m.def(
"bundle_adjustment", &BundleAdjustment,
96 py::call_guard<py::gil_scoped_release>(),
97 "Function for the bundle adjustment",
"input_path"_a,
"output_path"_a,
98 "bundle_adjustment_options"_a = colmap::BundleAdjustmentOptions());
102 m.def(
"extract_color", &ExtractColor,
103 py::call_guard<py::gil_scoped_release>(),
104 "Function for the extraction of images color",
"image_path"_a,
105 "input_path"_a,
"output_path"_a);
109 m.def(
"normal_mapper", &NormalMapper,
110 py::call_guard<py::gil_scoped_release>(),
111 "Function for the normal mapper",
"database_path"_a,
"image_path"_a,
112 "input_path"_a,
"output_path"_a,
"image_list_path"_a =
"",
117 m.def(
"hierarchical_mapper", &HierarchicalMapper,
118 py::call_guard<py::gil_scoped_release>(),
119 "Function for the hierarchical mapper",
"database_path"_a,
120 "image_path"_a,
"output_path"_a,
"num_workers"_a = -1,
121 "image_overlap"_a = 50,
"leaf_max_num_images"_a = 500,
126 m.def(
"filter_points", &FilterPoints,
127 py::call_guard<py::gil_scoped_release>(),
128 "Function for the filtering of points",
"input_path"_a,
129 "output_path"_a,
"min_track_len"_a = 2,
"max_reproj_error"_a = 4.0,
130 "min_tri_angle"_a = 1.5);
134 m.def(
"triangulate_points", &TriangulatePoints,
135 py::call_guard<py::gil_scoped_release>(),
136 "Function for the triangulation of points",
"database_path"_a,
137 "image_path"_a,
"input_path"_a,
"output_path"_a,
138 "clear_points"_a =
false,
143 m.def(
"rig_bundle_adjustment", &RigBundleAdjust,
144 py::call_guard<py::gil_scoped_release>(),
145 "Function for the rig bundle adjustment",
"input_path"_a,
146 "output_path"_a,
"rig_config_path"_a,
147 "estimate_rig_relative_poses"_a =
true,
148 "refine_relative_poses"_a =
true,
149 "bundle_adjustment_options"_a = colmap::BundleAdjustmentOptions());
155 py::module m_submodule =
156 m.def_submodule(
"sfm",
"Reconstruction structure from motion.");
void FunctionDocInject(py::module &pybind_module, const std::string &function_name, const std::unordered_map< std::string, std::string > &map_parameter_body_docs)
static const std::unordered_map< std::string, std::string > map_shared_argument_docstrings
void pybind_sfm_methods(py::module &m)
void pybind_structure_from_motion(py::module &m)
Generic file read and write utility for python interface.
colmap::IncrementalMapperOptions IncrementalMapperOptions