ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
database.cpp
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 #include "pipelines/database.h"
9 
10 #include "exe/database.h"
11 #include "pipelines/option_utils.h"
12 
13 namespace cloudViewer {
14 
15 int CleanDatabase(const std::string& database_path,
16  const std::string& clean_type) {
17  OptionsParser parser;
18  parser.registerOption("database_path", &database_path);
19  // supported type {all, images, features, matches}
20  parser.registerOption("type", &clean_type);
21  if (!parser.parseOptions()) return EXIT_FAILURE;
22 
23  return colmap::RunDatabaseCleaner(parser.getArgc(), parser.getArgv());
24 }
25 
26 int CreateDatabase(const std::string& database_path) {
27  OptionsParser parser;
28  parser.registerOption("database_path", &database_path);
29  if (!parser.parseOptions()) return EXIT_FAILURE;
30 
31  return colmap::RunDatabaseCreator(parser.getArgc(), parser.getArgv());
32 }
33 
34 int MergeDatabase(const std::string& database_path1,
35  const std::string& database_path2,
36  const std::string& merged_database_path) {
37  OptionsParser parser;
38  parser.registerOption("database_path1", &database_path1);
39  parser.registerOption("database_path2", &database_path2);
40  parser.registerOption("merged_database_path", &merged_database_path);
41  if (!parser.parseOptions()) return EXIT_FAILURE;
42 
43  return colmap::RunDatabaseMerger(parser.getArgc(), parser.getArgv());
44 }
45 
46 } // namespace cloudViewer
void registerOption(const std::string &name, const T *option)
Definition: option_utils.h:43
Generic file read and write utility for python interface.
int CleanDatabase(const std::string &database_path, const std::string &clean_type)
Definition: database.cpp:15
int MergeDatabase(const std::string &database_path1, const std::string &database_path2, const std::string &merged_database_path)
Definition: database.cpp:34
int CreateDatabase(const std::string &database_path)
Definition: database.cpp:26
int RunDatabaseCleaner(int argc, char **argv)
Definition: database.cc:40
int RunDatabaseMerger(int argc, char **argv)
Definition: database.cc:91
int RunDatabaseCreator(int argc, char **argv)
Definition: database.cc:81