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

Function TEST

src/colmap/mvs/model_test.cc:44–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42namespace {
43
44TEST(Model, ReadCOLMAP) {
45 SetPRNGSeed(0);
46 Reconstruction reconstruction;
47 SyntheticDatasetOptions synthetic_dataset_options;
48 synthetic_dataset_options.num_rigs = 1;
49 synthetic_dataset_options.num_cameras_per_rig = 1;
50 synthetic_dataset_options.num_frames_per_rig = 3;
51 synthetic_dataset_options.num_points3D = 10;
52 SynthesizeDataset(synthetic_dataset_options, &reconstruction);
53
54 const auto test_dir = CreateTestDir();
55 const auto sparse_path = test_dir / "sparse";
56 std::filesystem::create_directories(sparse_path);
57 reconstruction.WriteBinary(sparse_path);
58
59 Model model;
60 model.ReadFromCOLMAP(test_dir);
61 EXPECT_EQ(model.images.size(), reconstruction.NumRegImages());
62 EXPECT_EQ(model.points.size(), reconstruction.NumPoints3D());
63
64 Model model_lower;
65 model_lower.Read(test_dir, "colmap");
66 EXPECT_EQ(model_lower.images.size(), reconstruction.NumRegImages());
67 EXPECT_EQ(model_lower.points.size(), reconstruction.NumPoints3D());
68
69 // Verify case insensitivity.
70 Model model_upper;
71 model_upper.Read(test_dir, "COLMAP");
72 EXPECT_EQ(model_upper.images.size(), reconstruction.NumRegImages());
73 EXPECT_EQ(model_upper.points.size(), reconstruction.NumPoints3D());
74
75 const std::string name = model.GetImageName(0);
76 EXPECT_FALSE(name.empty());
77 EXPECT_EQ(model.GetImageIdx(name), 0);
78
79 EXPECT_THROW(model.GetImageIdx("nonexistent"), std::exception);
80 EXPECT_THROW(model.GetImageName(-1), std::exception);
81 EXPECT_THROW(model.GetImageName(model.images.size()), std::exception);
82}
83
84TEST(Model, ComputeSharedPoints) {
85 Model model;

Callers

nothing calls this directly

Calls 15

SetPRNGSeedFunction · 0.85
SynthesizeDatasetFunction · 0.85
CreateTestDirFunction · 0.85
WriteBinaryMethod · 0.80
ReadFromCOLMAPMethod · 0.80
sizeMethod · 0.80
NumRegImagesMethod · 0.80
emptyMethod · 0.80
GetImageIdxMethod · 0.80
ComputeSharedPointsMethod · 0.80
ComputeDepthRangesMethod · 0.80

Tested by

no test coverage detected