# Computing gaussian kernel for image blurring

When I compute a gaussian kernel for image blurring should I normalize the 1D vectors? Because when I apply the raw values sometimes the image gets lighter or darker. The function I'm using is $f(x) = \frac{1}{\sqrt{2\pi}\sigma}e^{\frac{-x^2}{2\sigma^2}}$ or the 2D function. So, should I just apply the results using cross correlation/convolution or should I normalize first?

• Welcome to cs.stackexchange! Have you tried to see what happens when you normalize the 1-D vectors? $f(x)$ is a one-dimensional function, but your image is 2-D. What are you feeding this function? The distance to the blurred pixel? Can you elaborate on how you compute the new colours? – Lieuwe Vinkhuijzen May 28 '16 at 18:47
• The input is the distance from the mean, but like @EvilJS replied the sum is greater or less than 1 and it makes the image lighter or darker. – ejuliobatista May 30 '16 at 14:33

Your function is used to compute 2D kernel, which you should normalize, otherwise if the sum of used weights is higher than $1$ your image gets lighter, when it is smaller it gets darker. You should not normalize vectors, because you apply 2D kernel, so normalized 1D vectors will not help.
• Yes it does, in 1D case, but then you take it to 2D and make symmetric mirror. There are probably neglible round off errors, but it also adds up to value not equal $1$. – Evil May 30 '16 at 16:19