mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-19 11:27:45 +08:00
Fix bug in bicubic interpolation and extend test cases to higher orders
This commit is contained in:
@@ -159,7 +159,7 @@ cdef inline double cubic_interpolation(double x, double[4] f):
|
||||
x : double
|
||||
Position in the interval [0, 1].
|
||||
f : double[4]
|
||||
Function values at positions [0, 1/3, 2/3, 1].
|
||||
Function values at positions [-1, 0, 1, 2].
|
||||
|
||||
Returns
|
||||
-------
|
||||
@@ -206,8 +206,8 @@ cdef inline double bicubic_interpolation(double* image, Py_ssize_t rows,
|
||||
if c < 0:
|
||||
c0 -= 1
|
||||
# scale position to range [0, 1]
|
||||
cdef double xr = (r - r0) / 3
|
||||
cdef double xc = (c - c0) / 3
|
||||
cdef double xr = r - floor(r)
|
||||
cdef double xc = c - floor(c)
|
||||
|
||||
cdef double fc[4]
|
||||
cdef double fr[4]
|
||||
|
||||
@@ -117,7 +117,7 @@ def test_fast_homography():
|
||||
tform = ProjectiveTransform(H)
|
||||
coords = warp_coords(tform.inverse, (img.shape[0], img.shape[1]))
|
||||
|
||||
for order in range(4):
|
||||
for order in range(6):
|
||||
for mode in ('constant', 'reflect', 'wrap', 'nearest'):
|
||||
p0 = map_coordinates(img, coords, mode=mode, order=order)
|
||||
p1 = warp(img, tform, mode=mode, order=order)
|
||||
@@ -130,8 +130,7 @@ def test_fast_homography():
|
||||
# ax3.imshow(np.abs(p0 - p1), cmap=plt.cm.gray)
|
||||
# plt.show()
|
||||
|
||||
d = np.mean(np.abs(p0 - p1))
|
||||
assert d < 0.001
|
||||
assert_array_equal(p0, p1)
|
||||
|
||||
|
||||
def test_rotate():
|
||||
|
||||
Reference in New Issue
Block a user