| 41 | namespace colmap { |
| 42 | |
| 43 | int 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 | |
| 87 | int RunDatabaseCreator(int argc, char** argv) { |
| 88 | OptionManager options; |
nothing calls this directly
no test coverage detected