MCPcopy Create free account
hub / github.com/colmap/colmap / RunDatabaseCleaner

Function RunDatabaseCleaner

src/colmap/exe/database.cc:43–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41namespace colmap {
42
43int RunDatabaseCleaner(int argc, char** argv) {
44 std::string type;
45
46 OptionManager options;
47 options.AddRequiredOption(
48 "type", &type, "{all, images, features, matches, two_view_geometries}");
49 options.AddDatabaseOptions();
50 if (!options.Parse(argc, argv)) {
51 return EXIT_FAILURE;
52 }
53
54 StringToLower(&type);
55 auto database = Database::Open(*options.database_path);
56
57 DatabaseTransaction transaction(database.get());
58 if (type == "all") {
59 LOG(INFO) << "Clearing all tables";
60 database->ClearAllTables();
61 } else if (type == "images") {
62 LOG(INFO) << "Clearing images and all dependent tables";
63 database->ClearImages();
64 database->ClearMatches();
65 database->ClearTwoViewGeometries();
66 } else if (type == "features") {
67 LOG(INFO) << "Clearing features, matches, and two-view geometries";
68 database->ClearDescriptors();
69 database->ClearKeypoints();
70 database->ClearMatches();
71 database->ClearTwoViewGeometries();
72 } else if (type == "matches") {
73 LOG(INFO) << "Clearing matches and two-view geometries";
74 database->ClearMatches();
75 database->ClearTwoViewGeometries();
76 } else if (type == "two_view_geometries") {
77 LOG(INFO) << "Clearing two-view geometries";
78 database->ClearTwoViewGeometries();
79 } else {
80 LOG(ERROR) << "Invalid cleanup type; no changes in database";
81 return EXIT_FAILURE;
82 }
83
84 return EXIT_SUCCESS;
85}
86
87int RunDatabaseCreator(int argc, char** argv) {
88 OptionManager options;

Callers

nothing calls this directly

Calls 10

StringToLowerFunction · 0.85
AddRequiredOptionMethod · 0.80
AddDatabaseOptionsMethod · 0.80
ParseMethod · 0.80
ClearAllTablesMethod · 0.45
ClearImagesMethod · 0.45
ClearMatchesMethod · 0.45
ClearDescriptorsMethod · 0.45
ClearKeypointsMethod · 0.45

Tested by

no test coverage detected