diff --git a/scikits/image/transform/_project.pyx b/scikits/image/transform/_project.pyx index d1788ab8..3e2b9b7d 100644 --- a/scikits/image/transform/_project.pyx +++ b/scikits/image/transform/_project.pyx @@ -35,7 +35,7 @@ cdef double get_pixel(double *image, int rows, int cols, """ if mode == 'C': - if (r < 0) or (r > cols - 1) or (c < 0) or (c > cols - 1): + if (r < 0) or (r > rows - 1) or (c < 0) or (c > cols - 1): return cval else: return image[r * cols + c] diff --git a/scikits/image/transform/tests/test_project.py b/scikits/image/transform/tests/test_project.py index 7ae24049..b7c25fdf 100644 --- a/scikits/image/transform/tests/test_project.py +++ b/scikits/image/transform/tests/test_project.py @@ -40,16 +40,20 @@ def test_fast_homography(): for mode in ('constant', 'mirror', 'wrap'): print 'Transform mode:', mode - p0 = homography(img, H, mode=mode) + p0 = homography(img, H, mode=mode, order=1) p1 = fast_homography(img, H, mode=mode) p1 = np.round(p1) ## import matplotlib.pyplot as plt - ## plt.imshow(np.abs(p0 - p1), cmap=plt.cm.gray) + ## f, (ax0, ax1, ax2, ax3) = plt.subplots(1, 4) + ## ax0.imshow(img) + ## ax1.imshow(p0, cmap=plt.cm.gray) + ## ax2.imshow(p1, cmap=plt.cm.gray) + ## ax3.imshow(np.abs(p0 - p1), cmap=plt.cm.gray) ## plt.show() d = np.mean(np.abs(p0 - p1)) - assert d < 0.1 + assert d < 0.2 if __name__ == "__main__":