I've been trying to create a LoG kernel for various sigma values. But the problem is that I always get float value matrix and I need integer value matrix as it is published on every document. I haven't find a method.

1st image: My functions and my output

2nd image: My expected matrix

Here is my function and my result

Expected output matrix

  • $\begingroup$ “integer value matrix as it is published on every document”. A LoG needs floating-point weights. You can scale it and round the values, but it will no longer be a proper LoG. The image you show is not a proper LoG. You also need to create a larger kernel that a 3x3. Use for example 2*ceil(3*sigma)+1 for the size. If you want to be more precise, use 4 instead of 3. $\endgroup$ Mar 17, 2019 at 14:12
  • $\begingroup$ “integer value matrix as it is published on every document” means "I want to create the matrix below" $\endgroup$
    – Fatih M.
    Mar 17, 2019 at 15:35
  • 1
    $\begingroup$ Don’t expect to create that using exp or anything related to a Gaussian. You can simply copy those weights if you want to reproduce what the paper does, but know that that is not a LoG! $\endgroup$ Mar 17, 2019 at 15:37
  • $\begingroup$ The answer you are looking for in here: math.stackexchange.com/questions/2445994/… You need to scale the matrix by multiply with -16/calculate(0, 0, sigma) $\endgroup$
    – NamPNQ
    Mar 25, 2021 at 12:43


Your Answer

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

Browse other questions tagged or ask your own question.