mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-13 12:40:24 +08:00
Merge pull request #379 from cpsaltis/fix_rotate
Fix resize argument handling in rotate.
This commit is contained in:
@@ -163,7 +163,7 @@ def rotate(image, angle, resize=False, order=1, mode='constant', cval=0.):
|
||||
tform = tform1 + tform2 + tform3
|
||||
|
||||
output_shape = None
|
||||
if not resize:
|
||||
if resize:
|
||||
# determine shape of output image
|
||||
corners = np.array([[1, 1], [1, rows], [cols, rows], [cols, 1]])
|
||||
corners = tform(corners - 1)
|
||||
|
||||
@@ -85,6 +85,17 @@ def test_rotate():
|
||||
assert_array_almost_equal(x90, np.rot90(x))
|
||||
|
||||
|
||||
def test_rotate_resize():
|
||||
x = np.zeros((10, 10), dtype=np.double)
|
||||
|
||||
x45 = rotate(x, 45, resize=False)
|
||||
assert x45.shape == (10, 10)
|
||||
|
||||
x45 = rotate(x, 45, resize=True)
|
||||
# new dimension should be d = sqrt(2 * (10/2)^2)
|
||||
assert x45.shape == (14, 14)
|
||||
|
||||
|
||||
def test_rescale():
|
||||
# same scale factor
|
||||
x = np.zeros((5, 5), dtype=np.double)
|
||||
|
||||
Reference in New Issue
Block a user