Skip to content

Commit

Permalink
Fix Laplacian filter wrong sign scikit-image#7357
Browse files Browse the repository at this point in the history
  • Loading branch information
pitkajuh authored and pitkajuh committed Apr 13, 2024
1 parent 7ae4fd8 commit a384418
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions skimage/filters/tests/test_edges.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,11 @@ def test_laplace_zeros():
[
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, -1.0, -1.0, -1.0, 0.0, 0.0, 0.0],
[0.0, 0.0, -1.0, 2.0, 1.0, 2.0, -1.0, 0.0, 0.0],
[0.0, 0.0, -1.0, 1.0, 0.0, 1.0, -1.0, 0.0, 0.0],
[0.0, 0.0, -1.0, 2.0, 1.0, 2.0, -1.0, 0.0, 0.0],
[0.0, 0.0, 0.0, -1.0, -1.0, -1.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 1.0, -2.0, -1.0, -2.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 1.0, -1.0, 0.0, -1.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 1.0, -2.0, -1.0, -2.0, 1.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
[0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0],
]
Expand Down
4 changes: 2 additions & 2 deletions skimage/restoration/uft.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,8 @@ def laplacian(ndim, shape, is_real=True):
idx = tuple(
[slice(1, 2)] * dim + [slice(None)] + [slice(1, 2)] * (ndim - dim - 1)
)
impr[idx] = np.array([-1.0, 0.0, -1.0]).reshape(
impr[idx] = np.array([1.0, 0.0, 1.0]).reshape(
[-1 if i == dim else 1 for i in range(ndim)]
)
impr[(slice(1, 2),) * ndim] = 2.0 * ndim
impr[(slice(1, 2),) * ndim] = -2.0 * ndim
return ir2tf(impr, shape, is_real=is_real), impr

0 comments on commit a384418

Please sign in to comment.