Friday, May 19, 2017

convolution - When should the sum of all elements of a gaussian kernel be zero?


I found an approximation of a 5x5 2D convolution kernel like this :


enter image description here


Here, the sum of the elements is zero and this one was used for Laplacian of Gaussian!


Another one here :


enter image description here


This one has all positive and the sum is not zero and is being used for smoothing.



Could anyone please tell me what is with the sum being zero in the previous case ?


References:


Link1 and Link2



Answer



The sum of a gaussian kernel cannot be zero, because all the elements are going to be positive. The first kernel you have shown, is most likely an edge detection kernel, (which is a type of high pass filter), so the elements add up to zero because you want to completely null out any DC/constant component.


The second kernel you have shown however, is a low pass kernel, indeed used in smoothing. Here the elements are not going to add up to zero because you are not trying to remove the 'constant' part of the image, in fact, you are trying to remove any high frequency noise.


Hope that helps.


No comments:

Post a Comment

periodic trends - Comparing radii in lithium, beryllium, magnesium, aluminium and sodium ions

Apparently the of last four, $\ce{Mg^2+}$ is closest in radius to $\ce{Li+}$. Is this true, and if so, why would a whole larger shell ($\ce{...