diff --git a/skimage/transform/geometric.py b/skimage/transform/geometric.py index 7b59242e..71ec7752 100644 --- a/skimage/transform/geometric.py +++ b/skimage/transform/geometric.py @@ -5,9 +5,6 @@ from scipy import ndimage from skimage.util import img_as_float -EPS = np.spacing(1) - - def _stackcopy(a, b): """Copy b into each color layer of a, such that:: @@ -182,8 +179,6 @@ def _transform(coords, matrix): # rescale to homogeneous coordinates dst[:, 0] /= dst[:, 2] dst[:, 1] /= dst[:, 2] - # values close to zero because of limited numerical precision - dst[np.abs(dst) < EPS] = 0 return dst[:, :2] diff --git a/skimage/transform/tests/test_geometric.py b/skimage/transform/tests/test_geometric.py index a227f597..d0edace1 100644 --- a/skimage/transform/tests/test_geometric.py +++ b/skimage/transform/tests/test_geometric.py @@ -92,10 +92,12 @@ def test_polynomial(): assert_array_almost_equal(tform.fwd(SRC), DST, 6) def test_homography(): - x = img_as_float(np.arange(9, dtype=np.uint8).reshape((3, 3)) + 1) + x = np.zeros((5,5), dtype=np.uint8) + x[1, 1] = 255 + x = img_as_float(x) theta = -np.pi/2 M = np.array([[np.cos(theta),-np.sin(theta),0], - [np.sin(theta), np.cos(theta),2], + [np.sin(theta), np.cos(theta),4], [0, 0, 1]]) x90 = homography(x, M, order=1) assert_array_almost_equal(x90, np.rot90(x))