| 1 |
import pytest |
| 2 |
|
| 3 |
import pycolmap |
| 4 |
|
| 5 |
|
| 6 |
def test_image_alignment_error_default_init(): |
| 7 |
error = pycolmap.ImageAlignmentError() |
| 8 |
assert error is not None |
| 9 |
|
| 10 |
|
| 11 |
def test_image_alignment_error_image_name_readwrite(): |
| 12 |
error = pycolmap.ImageAlignmentError() |
| 13 |
error.image_name = "test_image.jpg" |
| 14 |
assert error.image_name == "test_image.jpg" |
| 15 |
|
| 16 |
|
| 17 |
def test_image_alignment_error_rotation_error_deg_readwrite(): |
| 18 |
error = pycolmap.ImageAlignmentError() |
| 19 |
error.rotation_error_deg = 1.5 |
| 20 |
assert error.rotation_error_deg == 1.5 |
| 21 |
|
| 22 |
|
| 23 |
def test_image_alignment_error_proj_center_error_readwrite(): |
| 24 |
error = pycolmap.ImageAlignmentError() |
| 25 |
error.proj_center_error = 0.01 |
| 26 |
assert error.proj_center_error == 0.01 |
| 27 |
|
| 28 |
|
| 29 |
@pytest.mark.parametrize( |
| 30 |
"name", |
| 31 |
[ |
| 32 |
"align_reconstructions_via_reprojections", |
| 33 |
"align_reconstructions_via_proj_centers", |
| 34 |
"align_reconstructions_via_points", |
| 35 |
"compare_reconstructions", |
| 36 |
], |
| 37 |
) |
| 38 |
def test_public_api_callable(name): |
| 39 |
assert callable(getattr(pycolmap, name)) |
| 40 |
|
| 41 |
|
| 42 |
def test_compare_reconstructions_with_synthetic(synthetic_reconstruction): |
| 43 |
result = pycolmap.compare_reconstructions( |
| 44 |
synthetic_reconstruction, synthetic_reconstruction |
| 45 |
) |
| 46 |
assert result is not None |
| 47 |
assert "rec2_from_rec1" in result |
| 48 |
assert "errors" in result |