diff --git a/pipeline/sfm.cc b/pipeline/sfm.cc index 53ee6e31..a8f7a06b 100644 --- a/pipeline/sfm.cc +++ b/pipeline/sfm.cc @@ -51,16 +51,22 @@ std::map incremental_mapping( const py::object database_path_, const py::object image_path_, const py::object output_path_, - const IncrementalMapperOptions& options) { + const IncrementalMapperOptions& options, + const py::object input_path_) { std::string database_path = py::str(database_path_).cast(); THROW_CHECK_FILE_EXISTS(database_path); std::string image_path = py::str(image_path_).cast(); THROW_CHECK_DIR_EXISTS(image_path); + std::string input_path = py::str(input_path_).cast(); std::string output_path = py::str(output_path_).cast(); CreateDirIfNotExists(output_path); py::gil_scoped_release release; ReconstructionManager reconstruction_manager; + if (input_path != "") { + THROW_CHECK_DIR_EXISTS(input_path); + reconstruction_manager.Read(input_path); + } IncrementalMapperController mapper( &options, image_path, database_path, &reconstruction_manager); @@ -103,12 +109,13 @@ std::map incremental_mapping( const py::object image_path_, const py::object output_path_, const int num_threads, - const int min_num_matches) { + const int min_num_matches, + const py::object input_path_) { IncrementalMapperOptions options; options.num_threads = num_threads; options.min_num_matches = min_num_matches; return incremental_mapping( - database_path_, image_path_, output_path_, options); + database_path_, image_path_, output_path_, options, input_path_); } void init_sfm(py::module& m) { @@ -194,11 +201,13 @@ void init_sfm(py::module& m) { const py::object, const py::object, const py::object, - const IncrementalMapperOptions&)>(&incremental_mapping), + const IncrementalMapperOptions&, + const py::object)>(&incremental_mapping), py::arg("database_path"), py::arg("image_path"), py::arg("output_path"), py::arg("options") = mapper_options, + py::arg("input_path") = py::str(""), "Triangulate 3D points from known poses"); m.def("incremental_mapping", @@ -206,12 +215,14 @@ void init_sfm(py::module& m) { const py::object, const py::object, const int, - const int)>( + const int, + const py::object)>( &incremental_mapping), py::arg("database_path"), py::arg("image_path"), py::arg("output_path"), py::arg("num_threads") = mapper_options.num_threads, py::arg("min_num_matches") = mapper_options.min_num_matches, + py::arg("input_path") = py::str(""), "Triangulate 3D points from known poses"); }