1
$\begingroup$

In Image processing, one often uses the discrete Laplacian of Gaussian (LoG) to do edge detection with

$LoG(x,y) = -\frac{1}{\pi \sigma^4}[1-\frac{x^2+y^2}{2\sigma^2}]\cdot e^{-\frac{x^2+y^2}{2\sigma^2}}$

Various sources here, here or here give discrete Kernels of the LoG to be convoluted with the input image to yield the filtered version. However, I do not understand the derivation of this Kernel from the function.

One possible Kernel for $\sigma = 1.4$ is

$K = \begin{bmatrix}0.0& 1.0& 1.0& 2.0& 2.0& 2.0& 1.0& 1.0& 0.0\\ 1.0& 2.0& 4.0& 5.0& 5.0& 5.0& 4.0& 2.0& 1.0\\ 1.0& 4.0& 5.0& 3.0& 0.0& 3.0& 5.0& 4.0& 1.0\\ 2.0& 5.0& 3.0& -12.0& -24.0& -12.0& 3.0& 5.0& 2.0\\ 2.0& 5.0& 0.0& -24.0& -40.0& -24.0& 0.0& 5.0& 2.0\\ 2.0& 5.0& 3.0& -12.0& -24.0& -12.0& 3.0& 5.0& 2.0\\ 1.0& 4.0& 5.0& 3.0& 0.0& 3.0& 5.0& 4.0& 1.0\\ 1.0& 2.0& 4.0& 5.0& 5.0& 5.0& 4.0& 2.0& 1.0\\ 0.0& 1.0& 1.0& 2.0& 2.0& 2.0& 1.0& 1.0& 0.0\end{bmatrix}$

My question is, how these discrete Kernels are derived from the $LoG(x,y)$ function. Is there any scaling factor involved? Is it an integration over the discrete pixel area?

My calculated values for the central point (-40.0) are:

$LoG(0,0) \approx -0.1624$

and

$\iint\limits_{-0.5}^{0.5}{LoG(x,y)} dx dy \approx -0.0761$

$\endgroup$
0
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.