diff --git a/tests/conftest.py b/tests/conftest.py index 768d9d5..8db3785 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -81,7 +81,6 @@ def create_dem( Create a 2 band DEM file that covers the ortho bounds of the given `camera`. Band 1 is a sinusoidal surface, and band 2, a planar surface. """ - # TODO: add partial dem fixture # wgs84_bounds = transform_bounds(rio.CRS.from_string(ortho_crs_wgs84_vdatum), dem_crs, *bounds) # size = 1 + np.ceil((bounds[2:] - bounds[:2]) / (30, 30)).astype('int') # transform = from_bounds(*wgs84_bounds, *size) @@ -534,7 +533,7 @@ def ngi_crs(ngi_image_file) -> str: crs = im.crs return crs.to_proj4() -# TODO: move fixtures used by a single module to that module + @pytest.fixture(scope='session') def ngi_legacy_config_file() -> Path: """ Legacy format configuration file for NGI test data. """ @@ -582,3 +581,5 @@ def odm_lla_rpy_csv_file() -> Path: """ return root_path.joinpath('tests', 'data', 'io', 'odm_lla_rpy.csv') + +# TODO: move fixtures used by a single module to that module diff --git a/tests/test_camera.py b/tests/test_camera.py index 5adc94e..d1548b6 100644 --- a/tests/test_camera.py +++ b/tests/test_camera.py @@ -209,9 +209,9 @@ def test_project_im_size( test_camera_args['im_size'] = tuple(np.array(test_camera_args['im_size']) * scale) test_camera = create_camera(cam_type, **test_camera_args, **dist_param) - # find reference and test camera coords for world pts corresponding to reference image corners - ref_br = np.array(ref_camera._im_size) - 1 - ref_ji = np.array([[0, 0], [ref_br[0], 0], ref_br, [0, ref_br[1]]]).T + # find reference and test camera coords for world pts corresponding to reference image boundary pts + w, h = np.array(ref_camera._im_size) - 1 + ref_ji = np.array([[0, 0], [w / 2, 0], [w, 0], [w, h / 2], [w, h], [w / 2, h], [0, h], [0, h / 2]]).T xyz = ref_camera.pixel_to_world_z(ref_ji, 0) test_ji = test_camera.world_to_pixel(xyz) ref_xy = ref_camera._pixel_to_camera(ref_ji)[:2] diff --git a/tests/test_ortho.py b/tests/test_ortho.py index 91b2c7e..a016207 100644 --- a/tests/test_ortho.py +++ b/tests/test_ortho.py @@ -279,7 +279,6 @@ def test_mask_dem( # DEM < camera height to ensure no ortho artefacts in DEM > camera height areas. While the DEM mask excludes # (boundary) occluded pixels, the ortho image mask does not i.e. to compare these masks, there should be no # DEM - ortho occlusion. - # TODO: add test with dem that includes occlusion _xyz = tuple(np.array(camera_args['xyz']) + xyz_offset) _opk = tuple(np.array(camera_args['opk']) + np.radians(opk_offset)) camera: Camera = PinholeCamera( @@ -866,6 +865,6 @@ def test_process_camera( assert src_array.std() == pytest.approx(ortho_array[:, ortho_mask].std(), abs=15) -# TODO: dem reproject changes bounds with different v datum +# TODO: add test with dem that includes occlusion # TODO: add tests for other CRSs, spec'd in proj4 string, with vertical datum & with ortho & DEM in different CRSs ##