| 1 |
import pycolmap |
| 2 |
|
| 3 |
|
| 4 |
def test_image_pair_stat_init(): |
| 5 |
stat = pycolmap.ImagePairStat() |
| 6 |
assert stat is not None |
| 7 |
|
| 8 |
|
| 9 |
def test_image_pair_stat_num_tri_corrs(): |
| 10 |
stat = pycolmap.ImagePairStat() |
| 11 |
stat.num_tri_corrs = 10 |
| 12 |
assert stat.num_tri_corrs == 10 |
| 13 |
|
| 14 |
|
| 15 |
def test_image_pair_stat_num_total_corrs(): |
| 16 |
stat = pycolmap.ImagePairStat() |
| 17 |
stat.num_total_corrs = 20 |
| 18 |
assert stat.num_total_corrs == 20 |
| 19 |
|
| 20 |
|
| 21 |
def test_reprojection_error_type_pixel(): |
| 22 |
assert pycolmap.ReprojectionErrorType.PIXEL is not None |
| 23 |
|
| 24 |
|
| 25 |
def test_reprojection_error_type_normalized(): |
| 26 |
assert pycolmap.ReprojectionErrorType.NORMALIZED is not None |
| 27 |
|
| 28 |
|
| 29 |
def test_reprojection_error_type_angular(): |
| 30 |
assert pycolmap.ReprojectionErrorType.ANGULAR is not None |
| 31 |
|
| 32 |
|
| 33 |
def _make_observation_manager(reconstruction): |
| 34 |
correspondence_graph = pycolmap.CorrespondenceGraph() |
| 35 |
for image_id in reconstruction.images: |
| 36 |
image = reconstruction.image(image_id) |
| 37 |
correspondence_graph.add_image(image_id, image.num_points2D()) |
| 38 |
correspondence_graph.finalize() |
| 39 |
return pycolmap.ObservationManager(reconstruction, correspondence_graph) |
| 40 |
|
| 41 |
|
| 42 |
def test_observation_manager_init(synthetic_reconstruction): |
| 43 |
manager = _make_observation_manager(synthetic_reconstruction) |
| 44 |
assert manager is not None |
| 45 |
|
| 46 |
|
| 47 |
def test_observation_manager_image_pairs(synthetic_reconstruction): |
| 48 |
manager = _make_observation_manager(synthetic_reconstruction) |
| 49 |
pairs = manager.image_pairs |
| 50 |
assert hasattr(pairs, "__len__") |
| 51 |
|
| 52 |
|
| 53 |
def test_observation_manager_num_observations(synthetic_reconstruction): |
| 54 |
manager = _make_observation_manager(synthetic_reconstruction) |
| 55 |
image_ids = list(synthetic_reconstruction.images.keys()) |
| 56 |
count = manager.num_observations(image_ids[0]) |
| 57 |
assert isinstance(count, int) |
| 58 |
|
| 59 |
|
| 60 |
def test_observation_manager_num_correspondences(synthetic_reconstruction): |
| 61 |
manager = _make_observation_manager(synthetic_reconstruction) |
| 62 |
image_ids = list(synthetic_reconstruction.images.keys()) |
| 63 |
count = manager.num_correspondences(image_ids[0]) |
| 64 |
assert isinstance(count, int) |