Add image resize function

This commit is contained in:
Johannes Schönberger
2012-08-30 18:41:00 +02:00
parent 15cc7f1779
commit b2036aee5c
3 changed files with 61 additions and 3 deletions
+10 -1
View File
@@ -2,7 +2,7 @@ from numpy.testing import assert_array_almost_equal, run_module_suite
import numpy as np
from scipy.ndimage import map_coordinates
from skimage.transform import (warp, warp_coords, rotate,
from skimage.transform import (warp, warp_coords, rotate, resize,
AffineTransform,
ProjectiveTransform,
SimilarityTransform)
@@ -81,6 +81,15 @@ def test_rotate():
assert_array_almost_equal(x90, np.rot90(x))
def test_resize():
x = np.zeros((5, 5), dtype=np.double)
x[1, 1] = 1
resized = resize(x, (10, 10), order=0)
ref = np.zeros((10, 10))
ref[2:4, 2:4] = 1
assert_array_almost_equal(resized, ref)
def test_swirl():
image = img_as_float(data.checkerboard())