mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-11 10:31:50 +08:00
Add unit test to catch non-integer output shape bug
This commit is contained in:
@@ -1074,7 +1074,12 @@ def warp(image, inverse_map=None, map_args={}, output_shape=None, order=1,
|
||||
image = np.atleast_3d(img_as_float(image))
|
||||
ishape = np.array(image.shape)
|
||||
bands = ishape[2]
|
||||
output_shape = np.array(output_shape, dtype=int)
|
||||
|
||||
if output_shape is None:
|
||||
output_shape = ishape
|
||||
else:
|
||||
output_shape = np.array(output_shape, dtype=int)
|
||||
|
||||
|
||||
out = None
|
||||
|
||||
@@ -1111,10 +1116,6 @@ def warp(image, inverse_map=None, map_args={}, output_shape=None, order=1,
|
||||
out = out[..., 0]
|
||||
|
||||
if out is None: # use ndimage.map_coordinates
|
||||
|
||||
if output_shape is None:
|
||||
output_shape = ishape
|
||||
|
||||
rows, cols = output_shape[:2]
|
||||
|
||||
# inverse_map is a transformation matrix as numpy array
|
||||
|
||||
@@ -248,5 +248,10 @@ def test_inverse():
|
||||
assert_array_equal(warp(image, inverse_tform), warp(image, tform.inverse))
|
||||
|
||||
|
||||
def test_slow_warp_nonint_oshape():
|
||||
image = np.random.random((5, 5))
|
||||
warp(image, lambda xy: xy, output_shape=(13.1, 19.5))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_module_suite()
|
||||
|
||||
Reference in New Issue
Block a user