Skip to content

Commit

Permalink
use image boundary with mid-pts
Browse files Browse the repository at this point in the history
  • Loading branch information
dugalh committed Oct 1, 2023
1 parent af85278 commit 38fb962
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
5 changes: 3 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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. """
Expand Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions tests/test_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 1 addition & 2 deletions tests/test_ortho.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
##

0 comments on commit 38fb962

Please sign in to comment.