Recently I've implemented the LoG filter,
the only thing you need is that formula and sigma as a parameter.
If you need a fixed size mask, you can store the filter mask values in the matrix and use it,
or recalculate it each time and create the needed matrix.
The size of the filter depends on sigma value, if more than that size is used - it doesn't make a sence, because the rest part that is out of some maximum size are calculated to zeros using that formula.
So, for example you got a filter size = 9X9
Then in order to calculate the filter itself as a matrix,
you need to run the formula through this values :
int halfsize = size / 2;
for (int x = -halfsize; x < halfsize; ++x)
for (int y = -halfsize; y < halfsize; ++y)
mask[x][y] = LoGFunction(x, y);
Something like that.
It also means that filter size must be an odd value.
Hope this helps.
In your case,
size = 9
sigma = 1.4
x and y changes through -4 to 4.
using formula at point (0, 0) (it is the center of the filter)
you get something near to -12
But if you put the sigma to 0.2986
You will get the needed answer near to -40.
I also don't understand why it is written that sigma value is equal to 1.4
May ba I'm missing something..
Correct me if I made a mistake please