Add function to scale images

This commit is contained in:
Johannes Schönberger
2012-10-05 06:18:58 +02:00
parent 3126399eeb
commit c2d308c21a
3 changed files with 54 additions and 2 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, resize,
from skimage.transform import (warp, warp_coords, rotate, resize, scale,
AffineTransform,
ProjectiveTransform,
SimilarityTransform, homography)
@@ -94,6 +94,15 @@ def test_resize():
assert_array_almost_equal(resized, ref)
def test_scale():
x = np.zeros((5, 5), dtype=np.double)
x[1, 1] = 1
scaled = scale(x, 2, order=0)
ref = np.zeros((10, 10))
ref[2:4, 2:4] = 1
assert_array_almost_equal(scaled, ref)
def test_swirl():
image = img_as_float(data.checkerboard())