8000 Option manager moves to controllers to disentangle circular deps by ahojnnes · Pull Request #2058 · colmap/colmap · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Option manager moves to controllers to disentangle circular deps #2058

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/colmap/controllers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ COLMAP_ADD_SOURCES(
bundle_adjustment.h bundle_adjustment.cc
hierarchical_mapper.h hierarchical_mapper.cc
incremental_mapper.h incremental_mapper.cc
option_manager.h option_manager.cc
)

COLMAP_ADD_TEST(hierarchical_mapper_test hierarchical_mapper_test.cc)
Expand Down
5 changes: 3 additions & 2 deletions src/colmap/controllers/automatic_reconstruction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
#include "colmap/controllers/automatic_reconstruction.h"

#include "colmap/controllers/incremental_mapper.h"
#include "colmap/controllers/option_manager.h"
#include "colmap/feature/extraction.h"
#include "colmap/feature/matching.h"
#include "colmap/image/undistortion.h"
#include "colmap/mvs/fusion.h"
#include "colmap/mvs/meshing.h"
#include "colmap/mvs/patch_match.h"
#include "colmap/util/misc.h"
#include "colmap/util/option_manager.h"

namespace colmap {

Expand Down Expand Up @@ -233,7 +233,8 @@ void AutomaticReconstructionController::RunSparseMapper() {
active_thread_ = nullptr;

CreateDirIfNotExists(sparse_path);
reconstruction_manager_->Write(sparse_path, &option_manager_);
reconstruction_manager_->Write(sparse_path);
option_manager_.Write(JoinPaths(sparse_path, "project.ini"));
}

void AutomaticReconstructionController::RunDenseMapper() {
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/controllers/automatic_reconstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

#pragma once

#include "colmap/controllers/option_manager.h"
#include "colmap/scene/reconstruction_manager.h"
#include "colmap/util/option_manager.h"
#include "colmap/util/threading.h"

#include <memory>
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/controllers/bundle_adjustment.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

#pragma once

#include "colmap/controllers/option_manager.h"
#include "colmap/scene/reconstruction.h"
#include "colmap/util/option_manager.h"
#include "colmap/util/threading.h"

namespace colmap {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
//
// Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)

#include "colmap/util/option_manager.h"
#include "colmap/controllers/option_manager.h"

#include "colmap/controllers/incremental_mapper.h"
#include "colmap/estimators/bundle_adjustment.h"
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/exe/database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@

#include "colmap/exe/database.h"

#include "colmap/controllers/option_manager.h"
#include "colmap/scene/database.h"
#include "colmap/util/misc.h"
#include "colmap/util/option_manager.h"

namespace colmap {

Expand Down
2 changes: 1 addition & 1 deletion src/colmap/exe/feature.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
#include "colmap/exe/feature.h"

#include "colmap/camera/models.h"
#include "colmap/controllers/option_manager.h"
#include "colmap/exe/gui.h"
#include "colmap/feature/extraction.h"
#include "colmap/feature/matching.h"
#include "colmap/image/reader.h"
#include "colmap/util/misc.h"
#include "colmap/util/opengl_utils.h"
#include "colmap/util/option_manager.h"

namespace colmap {
namespace {
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/exe/gui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

#include "colmap/exe/gui.h"

#include "colmap/controllers/option_manager.h"
#include "colmap/util/opengl_utils.h"
#include "colmap/util/option_manager.h"

namespace colmap {

Expand Down
2 changes: 1 addition & 1 deletion src/colmap/exe/image.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@
#include "colmap/exe/image.h"

#include "colmap/controllers/incremental_mapper.h"
#include "colmap/controllers/option_manager.h"
#include "colmap/image/undistortion.h"
#include "colmap/scene/reconstruction.h"
#include "colmap/sfm/incremental_mapper.h"
#include "colmap/util/misc.h"
#include "colmap/util/option_manager.h"

namespace colmap {
namespace {
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/exe/model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@

#include "colmap/exe/model.h"

#include "colmap/controllers/option_manager.h"
#include "colmap/estimators/coordinate_frame.h"
#include "colmap/geometry/gps.h"
#include "colmap/geometry/pose.h"
#include "colmap/scene/alignment.h"
#include "colmap/util/misc.h"
#include "colmap/util/option_manager.h"
#include "colmap/util/threading.h"

namespace colmap {
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/exe/mvs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@

#include "colmap/exe/mvs.h"

#include "colmap/controllers/option_manager.h"
#include "colmap/mvs/fusion.h"
#include "colmap/mvs/meshing.h"
#include "colmap/mvs/patch_match.h"
#include "colmap/scene/reconstruction.h"
#include "colmap/util/misc.h"
#include "colmap/util/option_manager.h"

namespace colmap {

Expand Down
5 changes: 3 additions & 2 deletions src/colmap/exe/sfm.cc
CEB7
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@
#include "colmap/controllers/automatic_reconstruction.h"
#include "colmap/controllers/bundle_adjustment.h"
#include "colmap/controllers/hierarchical_mapper.h"
#include "colmap/controllers/option_manager.h"
#include "colmap/exe/gui.h"
#include "colmap/scene/reconstruction.h"
#include "colmap/util/misc.h"
#include "colmap/util/opengl_utils.h"
#include "colmap/util/option_manager.h"

#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>
Expand Down Expand Up @@ -295,7 +295,8 @@ int RunHierarchicalMapper(int argc, char** argv) {
return EXIT_FAILURE;
}

reconstruction_manager->Write(output_path, &options);
reconstruction_manager->Write(output_path);
options.Write(JoinPaths(output_path, "project.ini"));

return EXIT_SUCCESS;
}
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/exe/vocab_tree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#include "colmap/exe/vocab_tree.h"

#include "colmap/controllers/option_manager.h"
#include "colmap/exe/gui.h"
#include "colmap/feature/matching.h"
#include "colmap/feature/sift.h"
Expand All @@ -39,7 +40,6 @@
#include "colmap/scene/database.h"
#include "colmap/util/misc.h"
#include "colmap/util/opengl_utils.h"
#include "colmap/util/option_manager.h"

#include <numeric>

Expand Down
1 change: 0 additions & 1 deletion src/colmap/mvs/meshing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#include "colmap/util/endian.h"
#include "colmap/util/logging.h"
#include "colmap/util/misc.h"
#include "colmap/util/option_manager.h"
#include "colmap/util/ply.h"
#include "colmap/util/threading.h"
#include "colmap/util/timer.h"
Expand Down
7 changes: 1 addition & 6 deletions src/colmap/scene/reconstruction_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "colmap/scene/reconstruction_manager.h"

#include "colmap/util/misc.h"
#include "colmap/util/option_manager.h"

namespace colmap {

Expand Down Expand Up @@ -66,8 +65,7 @@ size_t ReconstructionManager::Read(const std::string& path) {
return idx;
}

void ReconstructionManager::Write(const std::string& path,
const OptionManager* options) const {
void ReconstructionManager::Write(const std::string& path) const {
std::vector<std::pair<size_t, size_t>> recon_sizes(reconstructions_.size());
for (size_t i = 0; i < reconstructions_.size(); ++i) {
recon_sizes[i] = std::make_pair(i, reconstructions_[i]->NumPoints3D());
Expand All @@ -83,9 +81,6 @@ void ReconstructionManager::Write(const std::string& path,
const std::string reconstruction_path = JoinPaths(path, std::to_string(i));
CreateDirIfNotExists(reconstruction_path);
reconstructions_[recon_sizes[i].first]->Write(reconstruction_path);
if (options != nullptr) {
options->Write(JoinPaths(reconstruction_path, "project.ini"));
}
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/colmap/scene/reconstruction_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ class ReconstructionManager {
size_t Read(const std::string& path);

// Write all managed reconstructions into sub-folders "0", "1", "2", ...
// If the option manager object is not null, the options are written
// to each respective reconstruction folder as well.
void Write(const std::string& path, const OptionManager* options) const;
void Write(const std::string& path) const;

private:
std::vector<std::shared_ptr<Reconstruction>> reconstructions_;
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/tools/example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
//
// Author: Johannes L. Schoenberger (jsch-at-demuc-dot-de)

#include "colmap/controllers/option_manager.h"
#include "colmap/scene/reconstruction.h"
#include "colmap/util/logging.h"
#include "colmap/util/option_manager.h"

// Simple example that reads and writes a reconstruction.
int main(int argc, char** argv) {
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/ui/bundle_adjustment_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@

#pragma once

#include "colmap/controllers/option_manager.h"
#include "colmap/scene/reconstruction.h"
#include "colmap/ui/options_widget.h"
#include "colmap/ui/thread_control_widget.h"
#include "colmap/util/option_manager.h"

#include <QtCore>
#include <QtWidgets>
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/ui/database_management_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@

#pragma once

#include "colmap/controllers/option_manager.h"
#include "colmap/scene/database.h"
#include "colmap/ui/image_viewer_widget.h"
#include "colmap/util/misc.h"
#include "colmap/util/option_manager.h"

#include <QtCore>
#include <QtWidgets>
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/ui/dense_reconstruction_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@

#pragma once

#include "colmap/controllers/option_manager.h"
#include "colmap/mvs/fusion.h"
#include "colmap/ui/image_viewer_widget.h"
#include "colmap/ui/options_widget.h"
#include "colmap/ui/thread_control_widget.h"
#include "colmap/util/option_manager.h"

#include <QtCore>
#include <QtWidgets>
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/ui/feature_extraction_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

#pragma once

#include "colmap/controllers/option_manager.h"
#include "colmap/util/misc.h"
#include "colmap/util/option_manager.h"

#include <QtCore>
#include <QtWidgets>
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/ui/feature_matching_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

#pragma once

#include "colmap/controllers/option_manager.h"
#include "colmap/util/misc.h"
#include "colmap/util/option_manager.h"

#include <QtCore>
#include <QtWidgets>
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/ui/image_viewer_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@

#pragma once

#include "colmap/controllers/option_manager.h"
#include "colmap/geometry/projection.h"
#include "colmap/scene/database.h"
#include "colmap/scene/reconstruction.h"
#include "colmap/ui/qt_utils.h"
#include "colmap/util/option_manager.h"

#include <QtCore>
#include <QtWidgets>
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/ui/log_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

#pragma once

#include "colmap/util/option_manager.h"
#include "colmap/controllers/option_manager.h"

#include <QtGui>
#include <QtWidgets>
Expand Down
3 changes: 2 additions & 1 deletion src/colmap/ui/main_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,8 @@ void MainWindow::ExportAll() {
}

thread_control_widget_->StartFunction("Exporting...", [this, export_path]() {
reconstruction_manager_->Write(export_path, &options_);
reconstruction_manager_->Write(export_path);
options_.Write(JoinPaths(export_path, "project.ini"));
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/colmap/ui/match_matrix_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

#pragma once

#include "colmap/controllers/option_manager.h"
#include "colmap/ui/image_viewer_widget.h"
#include "colmap/util/option_manager.h"

namespace colmap {

Expand Down
2 changes: 1 addition & 1 deletion src/colmap/ui/model_viewer_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

#pragma once

#include "colmap/controllers/option_manager.h"
#include "colmap/scene/database.h"
#include "colmap/scene/reconstruction.h"
#include "colmap/ui/colormaps.h"
Expand All @@ -41,7 +42,6 @@
#include "colmap/ui/point_viewer_widget.h"
#include "colmap/ui/render_options.h"
#include "colmap/ui/triangle_painter.h"
#include "colmap/util/option_manager.h"

#include <QOpenGLFunctions_3_2_Core>
#include <QtCore>
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/ui/point_viewer_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

#pragma once

#include "colmap/controllers/option_manager.h"
#include "colmap/scene/reconstruction.h"
#include "colmap/util/option_manager.h"

#include <QtCore>
#include <QtWidgets>
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/ui/project_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

#pragma once

#include "colmap/controllers/option_manager.h"
#include "colmap/util/misc.h"
#include "colmap/util/option_manager.h"

#include <QtCore>
#include <QtWidgets>
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/ui/reconstruction_options_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

#pragma once

#include "colmap/controllers/option_manager.h"
#include "colmap/ui/options_widget.h"
#include "colmap/util/option_manager.h"

#include <QtCore>
#include <QtWidgets>
Expand Down
2 changes: 1 addition & 1 deletion src/colmap/ui/undistortion_widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@

#pragma once

#include "colmap/controllers/option_manager.h"
#include "colmap/image/undistortion.h"
#include "colmap/scene/reconstruction.h"
#include "colmap/ui/options_widget.h"
#include "colmap/ui/thread_control_widget.h"
#include "colmap/util/misc.h"
#include "colmap/util/option_manager.h"

#include <QtCore>
#include <QtWidgets>
Expand Down
Loading
0