51 reconstruction_manager_(reconstruction_manager),
52 active_thread_(nullptr) {
70 LOG(FATAL) <<
"Data type not supported";
120 if (resolved_vocab_tree_path.empty()) {
125 if (!resolved_vocab_tree_path.empty()) {
126 #ifdef COLMAP_DOWNLOAD_ENABLED
133 if (resolved_vocab_tree_path.find(
"http://") == 0 ||
134 resolved_vocab_tree_path.find(
"https://") == 0 ||
135 resolved_vocab_tree_path.find(
';') != std::string::npos) {
136 LOG(WARNING) <<
"vocab_tree_path appears to be a URI but download support is disabled. "
137 <<
"Please provide a local path or enable DOWNLOAD_ENABLED.";
138 resolved_vocab_tree_path =
"";
151 if (!resolved_vocab_tree_path.empty()) {
166 void AutomaticReconstructionController::Run() {
171 RunFeatureExtraction();
177 RunFeatureMatching();
198 void AutomaticReconstructionController::RunFeatureExtraction() {
199 CHECK(feature_extractor_);
201 feature_extractor_->Start();
202 feature_extractor_->Wait();
203 feature_extractor_.reset();
207 void AutomaticReconstructionController::RunFeatureMatching() {
208 Thread* matcher =
nullptr;
210 matcher = sequential_matcher_.get();
214 const size_t num_images = database.NumImages();
216 if (vocab_tree_matcher_ && num_images >= 200) {
217 matcher = vocab_tree_matcher_.get();
219 matcher = exhaustive_matcher_.get();
227 exhaustive_matcher_.reset();
228 sequential_matcher_.reset();
229 vocab_tree_matcher_.reset();
233 void AutomaticReconstructionController::RunSparseMapper() {
237 std::sort(dir_list.begin(), dir_list.end());
238 if (dir_list.size() > 0) {
240 <<
"WARNING: Skipping sparse reconstruction because it is "
243 for (
const auto& dir : dir_list) {
270 const std::string dense_path =
272 const std::string fused_path =
JoinPaths(dense_path,
"fused.ply");
274 std::string meshing_path;
276 meshing_path =
JoinPaths(dense_path,
"meshed-poisson.ply");
278 meshing_path =
JoinPaths(dense_path,
"meshed-delaunay.ply");
313 patch_match_controller.
Start();
314 patch_match_controller.
Wait();
320 <<
"WARNING: Skipping patch match stereo because CUDA is not available."
334 fusion_options.min_num_pixels =
335 std::min(num_reg_images + 1, fusion_options.min_num_pixels);
337 fusion_options, dense_path,
"COLMAP",
"",
344 std::cout <<
"Writing output: " << fused_path <<
std::endl;
370 <<
"WARNING: Skipping Delaunay meshing because CGAL is "
393 const std::string textured_path =
394 JoinPaths(dense_path,
"textured-mesh.obj");
416 std::cout <<
"Writing textured mesh: " << textured_path
OptionManager option_manager_
virtual void OnTexturedMeshGenerated(size_t reconstruction_idx, const std::string &textured_path)
virtual void OnMeshGenerated(size_t reconstruction_idx, const std::string &mesh_path)
AutomaticReconstructionController(const Options &options, ReconstructionManager *reconstruction_manager)
virtual void RunDenseMapper()
ReconstructionManager * reconstruction_manager_
virtual void OnFusedPointsGenerated(size_t reconstruction_idx, const std::vector< PlyPoint > &points)
std::shared_ptr< SequentialMatchingOptions > sequential_matching
std::shared_ptr< mvs::PoissonMeshingOptions > poisson_meshing
std::shared_ptr< mvs::DelaunayMeshingOptions > delaunay_meshing
std::shared_ptr< TexturingOptions > texturing
void ModifyForIndividualData()
std::shared_ptr< mvs::PatchMatchOptions > patch_match_stereo
std::shared_ptr< std::string > database_path
std::shared_ptr< mvs::StereoFusionOptions > stereo_fusion
void ModifyForVideoData()
std::shared_ptr< SiftMatchingOptions > sift_matching
std::shared_ptr< BundleAdjustmentOptions > bundle_adjustment
void ModifyForInternetData()
std::shared_ptr< IncrementalMapperOptions > mapper
void ModifyForMediumQuality()
void ModifyForHighQuality()
std::shared_ptr< SiftExtractionOptions > sift_extraction
void ModifyForLowQuality()
std::shared_ptr< ImageReaderOptions > image_reader
void ModifyForExtremeQuality()
std::shared_ptr< VocabTreeMatchingOptions > vocab_tree_matching
std::shared_ptr< ExhaustiveMatchingOptions > exhaustive_matching
std::shared_ptr< std::string > image_path
const Reconstruction & Get(const size_t idx) const
size_t Read(const std::string &path)
void Write(const std::string &path, const OptionManager *options) const
size_t NumRegImages() const
const Timer & GetTimer() const
void PrintMinutes() const
const std::vector< std::vector< int > > & GetFusedPointsVisibility() const
const std::vector< PlyPoint > & GetFusedPoints() const
QTextStream & endl(QTextStream &stream)
colmap::IncrementalMapperController IncrementalMapperController
void WritePointsVisibility(const std::string &path, const std::vector< std::vector< int >> &points_visibility)
bool PoissonMeshing(const PoissonMeshingOptions &options, const std::string &input_path, const std::string &output_path)
static const std::string kDefaultVocabTreeUri
bool ExistsCameraModelWithName(const std::string &model_name)
void WriteBinaryPlyPoints(const std::string &path, const std::vector< PlyPoint > &points, const bool write_normal, const bool write_rgb)
bool ExistsDir(const std::string &path)
bool ExistsFile(const std::string &path)
void CreateDirIfNotExists(const std::string &path)
std::string JoinPaths(T const &... paths)
std::vector< std::string > GetDirList(const std::string &path)
std::filesystem::path MaybeDownloadAndCacheFile(const std::string &uri)
std::string to_string(const T &n)
std::string workspace_path
std::string vocab_tree_path
std::string database_path