First, let me try to give you some intuition of why you have to normalize by scale at all. As you go from finer to coarser scales you blur the image. That makes the intensity surface more and more smooth. That, in turn, means that the amplitude of image derivatives gets smaller as you go up the scale volume. This is a problem for finding interest points, because you are looking for local extrema over scale. Without normalization you will always get the maximum at the finest scale and the minimum at the coarsest scale, and that's not what you want.
So, image derivatives are attenuated as $\sigma$ increases. In fact, the derivatives decrease exponentially as a function of $\sigma$. To compensate for that you have to normalize them by multiplying the $n$-th derivative by $\sigma^n$. Since the LoG is a combination of second derivatives, you have to multiply it by $\sigma^2$.
You can find the derivation and a better explanation of this in this paper by Toni Lindeberg.
The answer is scaling. The matrix $K$ is simply a $n\times n$ matrix with $n$ being odd and
$K(i,j)=LoG(i-\frac{n-1}{2},j-\frac{n-1}{2})$.
The whole matrix can be scaled for easier calculation in the integer range.
The following python code produces a matrix, that is "close enough" to the wanted output:
import numpy as np
def LoG(sigma, x, y):
laplace = -1/(np.pi*sigma**4)*(1-(x**2+y**2)/(2*sigma**2))*np.exp(-(x**2+y**2)/(2*sigma**2))
return laplace
def LoG_discrete(sigma, n):
l = np.zeros((n,n))
for i in range(n):
for j in range(n):
l[i,j] = LoG(sigma, (i-(n-1)/2),(j-(n-1)/2))
return l
sigma = 1.4
l = np.round(LoG_discrete(sigma, 9)*(-40/LoG(sigma,0,0)))
$K = \begin{bmatrix}0& 0& 1& 2& 2& 2& 1& 0& 0\\
0& 1& 3& 5& 5& 5& 3& 1& 0\\
1& 3& 5& 3& 0& 3& 5& 3& 1\\
2& 5& 3&-12& -23& -12& 3& 5& 2\\
2& 5& 0& -23& -40& -23& 0& 5& 2\\
2& 5& 3&-12& -23& -12& 3& 5& 2\\
1& 3& 5& 3& 0& 3& 5& 3& 1\\
0& 1& 3& 5& 5& 5& 3& 1& 0\\
0& 0& 1& 2& 2& 2& 1& 0& 0\end{bmatrix}$
Best Answer
A kernel $h$ is separable if and only if all its rows are multiples of each other. Then you can pick one, call it $f$, make a column of the multiplicative factors, call it $g$, and find that $h = f*g$.
You can't do this for the 2D Laplacian kernel, because $[0,1,0]$ is not a multiple of $[1,-4,1]$.