You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The purpose of a Laplace filter is to compute an approximation for the second derivative. Which means that at the position of a maximum, it should give us back a negative number. That is e.g. the behavior of the scipy implementation of a Laplace filter. The filter matrix in skimage is inverted.
Fixing this bug will break the workarounds some people might have used in the past (i.e. multiplying the skimage result with minus 1).
Way to reproduce:
importnumpyasnpimportskimageasskifromscipyimportsignalmaximum=np.outer(signal.windows.gaussian(5, 1)*10, signal.windows.gaussian(5,1))*10np.set_printoptions(precision=1)
print ('a 2D Gaussian maximum:\n',maximum)
laplace_result=ski.filters.laplace(maximum)
print('\nLaplace filter result:\n',laplace_result)
### the underlying reason is that the signs in the filter matrix are inverted### as can be seen by a comparison with the scipy implementationfromscipyimportndimageA=np.zeros((3,3))
A[1,1] =1laplace_filter_scipy=ndimage.laplace(A)
laplace_filter_skimage=ski.filters.laplace(A)
print('scipy:\n',laplace_filter_scipy)
print('\nskimage:\n',laplace_filter_skimage)
Description:
The purpose of a Laplace filter is to compute an approximation for the second derivative. Which means that at the position of a maximum, it should give us back a negative number. That is e.g. the behavior of the scipy implementation of a Laplace filter. The filter matrix in skimage is inverted.
Fixing this bug will break the workarounds some people might have used in the past (i.e. multiplying the skimage result with minus 1).
Way to reproduce:
Version information:
The text was updated successfully, but these errors were encountered: