I am having trouble implementing a LoG kernel. I am trying to implement 9x9 kernal with theta = 1.4 as shown in this link http://homepages.inf.ed.ac.uk/rbf/HIPR2/log.htm.
However, I am having difficulty with the formula itself. If someone could tell me how to calculate the center ie what x and y values to use in order to get -40 in the 9x9 kernel it'd be greatly appreciated.
You don't need to worry about the formula - that is just used to generate the coefficients. You just need to apply those 9x9 coefficients to your image.
Example (untested code !):
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 :
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