| 1 |
import numpy as np |
| 2 |
import pytest |
| 3 |
|
| 4 |
import pycolmap |
| 5 |
|
| 6 |
|
| 7 |
def test_two_view_geometry_options_default_init(): |
| 8 |
options = pycolmap.TwoViewGeometryOptions() |
| 9 |
assert options is not None |
| 10 |
|
| 11 |
|
| 12 |
def test_two_view_geometry_options_min_num_inliers_readwrite(): |
| 13 |
options = pycolmap.TwoViewGeometryOptions() |
| 14 |
assert isinstance(options.min_num_inliers, int) |
| 15 |
options.min_num_inliers = 30 |
| 16 |
assert options.min_num_inliers == 30 |
| 17 |
|
| 18 |
|
| 19 |
@pytest.mark.parametrize( |
| 20 |
"name", |
| 21 |
[ |
| 22 |
"estimate_calibrated_two_view_geometry", |
| 23 |
"estimate_two_view_geometry", |
| 24 |
"estimate_two_view_geometry_pose", |
| 25 |
"compute_squared_sampson_error", |
| 26 |
], |
| 27 |
) |
| 28 |
def test_public_api_callable(name): |
| 29 |
assert callable(getattr(pycolmap, name)) |
| 30 |
|
| 31 |
|
| 32 |
def test_compute_squared_sampson_error_with_identity(): |
| 33 |
points1 = [np.array([1.0, 0.0]), np.array([0.0, 1.0])] |
| 34 |
points2 = [np.array([1.0, 0.0]), np.array([0.0, 1.0])] |
| 35 |
matrix = np.eye(3) |
| 36 |
residuals = pycolmap.compute_squared_sampson_error(points1, points2, matrix) |
| 37 |
assert isinstance(residuals, list) |
| 38 |
assert len(residuals) == 2 |