mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-13 17:45:20 +08:00
Add test for N-D warping
This commit is contained in:
@@ -55,6 +55,25 @@ def test_warp_matrix():
|
||||
outx = warp(x, matrix, order=5)
|
||||
|
||||
|
||||
def test_warp_nd():
|
||||
for dim in range(2, 8):
|
||||
shape = dim * (5,)
|
||||
|
||||
x = np.zeros(shape, dtype=np.double)
|
||||
x_c = dim * (2,)
|
||||
x[x_c] = 1
|
||||
refx = np.zeros(shape, dtype=np.double)
|
||||
refx_c = dim * (1,)
|
||||
refx[refx_c] = 1
|
||||
|
||||
coord_grid = dim * (np.arange(5),)
|
||||
coords = np.array(np.meshgrid(*coord_grid)) + 1
|
||||
|
||||
outx = warp(x, coords, order=0, cval=0)
|
||||
|
||||
assert_array_almost_equal(outx, refx)
|
||||
|
||||
|
||||
def test_warp_clip():
|
||||
x = 2 * np.ones((5, 5), dtype=np.double)
|
||||
matrix = np.eye(3)
|
||||
|
||||
Reference in New Issue
Block a user