Search code examples
c#image-processingmask

bigger mask size for laplacian filter?


I was implementing a simple laplacian filter for an image processing project i was working on. I read that the mask for a 3x3 filter is:

+0 -1 +0
-1 +5 -1
+0 -1 +0

but i was wondering about the 5x5 mask.. is it:

+0 +0 +1 +0 +0
+0 +0 +1 +0 +0
+1 +1 +9 +1 +1    << like a plus (+) sign
+0 +0 +1 +0 +0
+0 +0 +1 +0 +0

OR:

+0 +0 +1 +0 +0
+0 +1 +1 +1 +0
+1 +1 13 +1 +1    << like a circle
+0 +1 +1 +1 +0
+0 +0 +1 +0 +0

thanks for your help


Solution

  • Using Mathematica, I obtained the following for the Laplacian and the Laplacian of Gaussian kernels (the latter will be less sensitive to noise). Depending on your application, it may be safe to multiply these masks by an arbitrary positive number. Note that the sum of the coefficients is 0.

    enter image description here