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

Function TEST

src/colmap/controllers/image_reader_test.cc:183–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181 /*extension=*/".png")));
182
183TEST(ImageReaderTest, SingleCamera) {
184 auto database = Database::Open(kInMemorySqliteDatabasePath);
185 const auto test_dir = CreateTestDir();
186
187 ImageReaderOptions options;
188 options.image_path = test_dir / "images";
189 options.single_camera = true;
190 CreateDirIfNotExists(options.image_path);
191
192 // Create 3 test images with same dimensions
193 Bitmap test_bitmap(10, 20, true);
194 test_bitmap.Write(options.image_path / "0.png");
195 test_bitmap.Write(options.image_path / "1.png");
196 test_bitmap.Write(options.image_path / "2.png");
197
198 ImageReader image_reader(options, database.get());
199 EXPECT_EQ(image_reader.NumImages(), 3);
200
201 Rig rig;
202 Camera camera;
203 Image image;
204 PosePrior pose_prior;
205 Bitmap bitmap;
206 Bitmap mask;
207
208 for (int i = 0; i < 3; ++i) {
209 const auto status =
210 image_reader.Next(&rig, &camera, &image, &pose_prior, &bitmap, &mask);
211 ASSERT_EQ(status, ImageReader::Status::SUCCESS);
212 }
213
214 EXPECT_EQ(database->NumRigs(), 1);
215 EXPECT_EQ(database->NumCameras(), 1);
216}
217
218TEST(ImageReaderTest, SingleCameraDimensionError) {
219 auto database = Database::Open(kInMemorySqliteDatabasePath);

Callers

nothing calls this directly

Calls 15

CreateTestDirFunction · 0.85
CreateDirIfNotExistsFunction · 0.85
GetParentDirFunction · 0.85
CameraModelNameToIdFunction · 0.85
FeatureDescriptorsClass · 0.85
AddRefSensorMethod · 0.80
SensorIdMethod · 0.80
SetNameMethod · 0.80
SetCameraIdMethod · 0.80
SetImageIdMethod · 0.80
ImageIdMethod · 0.80
WriteMethod · 0.45

Tested by

no test coverage detected