remove inconsistent numeric correction and fix test case

This commit is contained in:
Johannes Schönberger
2012-07-02 09:27:35 +02:00
parent acb1d71cd5
commit 8bde92b66c
2 changed files with 4 additions and 7 deletions
-5
View File
@@ -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]
+4 -2
View File
@@ -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))