| 1 |
import pytest |
| 2 |
|
| 3 |
import pycolmap |
| 4 |
|
| 5 |
|
| 6 |
@pytest.fixture |
| 7 |
def simple_camera(): |
| 8 |
return pycolmap.Camera.create_from_model_id( |
| 9 |
1, pycolmap.CameraModelId.PINHOLE, 500.0, 1024, 768 |
| 10 |
) |
| 11 |
|
| 12 |
|
| 13 |
@pytest.fixture(scope="session") |
| 14 |
def synthetic_reconstruction(): |
| 15 |
options = pycolmap.SyntheticDatasetOptions() |
| 16 |
options.num_cameras_per_rig = 1 |
| 17 |
options.num_frames_per_rig = 3 |
| 18 |
options.num_points3D = 50 |
| 19 |
return pycolmap.synthesize_dataset(options) |
| 20 |
|
| 21 |
|
| 22 |
@pytest.fixture |
| 23 |
def database(tmp_path): |
| 24 |
with pycolmap.Database.open(str(tmp_path / "test.db")) as db: |
| 25 |
yield db |
| 26 |
|
| 27 |
|
| 28 |
@pytest.fixture |
| 29 |
def populated_database(database): |
| 30 |
camera = pycolmap.Camera.create_from_model_id( |
| 31 |
1, pycolmap.CameraModelId.PINHOLE, 500.0, 1024, 768 |
| 32 |
) |
| 33 |
camera_id = database.write_camera(camera) |
| 34 |
image = pycolmap.Image() |
| 35 |
image.name = "test.jpg" |
| 36 |
image.camera_id = camera_id |
| 37 |
image_id = database.write_image(image) |
| 38 |
return database, camera_id, image_id |