ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
automatic_reconstruction.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <string>
11 
13 #include "retrieval/resources.h"
14 #include "util/option_manager.h"
15 #include "util/threading.h"
16 
17 namespace colmap {
18 
20 public:
21  enum class DataType { INDIVIDUAL, VIDEO, INTERNET };
22  enum class Quality { LOW, MEDIUM, HIGH, EXTREME };
23  enum class Mesher { POISSON, DELAUNAY };
24 
25  struct Options {
26  // The path to the workspace folder in which all results are stored.
27  std::string workspace_path;
28 
29  // The path to the image folder which are used as input.
30  std::string image_path;
31 
32  // The path to the mask folder which are used as input.
33  std::string mask_path;
34 
35  // The path to the vocabulary tree for feature matching.
37 
38  // The type of input data used to choose optimal mapper settings.
40 
41  // Whether to perform low- or high-quality reconstruction.
43 
44  // Whether to use shared intrinsics or not.
45  bool single_camera = false;
46 
47  // Which camera model to use for images.
48  std::string camera_model = "SIMPLE_RADIAL";
49 
50  // Whether to perform sparse mapping.
51  bool sparse = true;
52 
53 // Whether to perform dense mapping.
54 #ifdef CUDA_ENABLED
55  bool dense = true;
56 #else
57  bool dense = false;
58 #endif
59 
60  // The meshing algorithm to be used.
61 #ifdef CGAL_ENABLED
63 #else
65 #endif
66 
67  // Whether to perform surface texturing.
68  bool texturing = true;
69 
70  // The number of threads to use in all stages.
71  int num_threads = -1;
72 
73  // Whether to use the GPU in feature extraction and matching.
74 #ifdef CUDA_ENABLED
75  bool use_gpu = true;
76 #else
77  bool use_gpu = false;
78 #endif
79 
80  // Index of the GPU used for GPU stages. For multi-GPU computation,
81  // you should separate multiple GPU indices by comma, e.g., "0,1,2,3".
82  // By default, all GPUs will be used in all stages.
83  std::string gpu_index = "-1";
84  };
85 
87  const Options& options,
88  ReconstructionManager* reconstruction_manager);
89 
90  void Stop() override;
91 
92 protected:
93  virtual void RunDenseMapper();
94 
95  // Hook methods for derived classes to customize behavior
96  virtual void OnFusedPointsGenerated(size_t reconstruction_idx,
97  const std::vector<PlyPoint>& points) {}
98  virtual void OnMeshGenerated(size_t reconstruction_idx,
99  const std::string& mesh_path) {}
100  virtual void OnTexturedMeshGenerated(size_t reconstruction_idx,
101  const std::string& textured_path) {}
102 
103  // Protected members for derived classes
108 
109 private:
110  void Run() override;
111  void RunFeatureExtraction();
112  void RunFeatureMatching();
113  void RunSparseMapper();
114 
115  std::unique_ptr<Thread> feature_extractor_;
116  std::unique_ptr<Thread> exhaustive_matcher_;
117  std::unique_ptr<Thread> sequential_matcher_;
118  std::unique_ptr<Thread> vocab_tree_matcher_;
119 };
120 
121 } // namespace colmap
int points
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 OnFusedPointsGenerated(size_t reconstruction_idx, const std::vector< PlyPoint > &points)
static const std::string kDefaultVocabTreeUri
Definition: resources.h:25