I am trying to figure out the kernel being used in skimage.filters's laplace function. I know that a Laplacian filter is based on matrix convolution, but I just can't seem to make sense of the values produced by skimage.filters's laplace function.
This is an example:
>>> import numpy as np
>>> import skimage
>>> from skimage.filters import laplace
>>> x = [[2,3,2],[5,3,6],[3,7,3]]
>>> x = np.array(x)
>>> x
array([[2, 3, 2],
[5, 3, 6],
[3, 7, 3]])
>>> laplace(x, ksize=3)
array([[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
[ 0.00000000e+00, -9.75781955e-19, 0.00000000e+00],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00]])
If skimage.filters's laplace function uses a kernel/operator of
[[ 0, 1, 0],
[ 1, -4, 1],
[ 0, 1, 0]]
then according to matrix convolution, it should have produced the output of
[[ 0, 5, -1],
[12, -9, 16],
[ 0, 19, -1]]
instead of
[[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00],
[ 0.00000000e+00, -9.75781955e-19, 0.00000000e+00],
[ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00]]
I am very confused on what kernel/operator skimage.filters's laplace function is using to have almost every output value so close to zero, such as -9.75781955e-19. I honestly don't think any reasonable kernel/operator could produce this output, so maybe I am just not understanding how Python's skimage.filters's laplace function is working...
Any help/comments/suggestions/insights to this question would be greatly appreciated. Thank you.