mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-02 18:48:48 +08:00
remove inconsistent numeric correction and fix test case
This commit is contained in:
@@ -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]
|
||||
|
||||
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user