# What is the difference between a simple gaussian filter and gaussian filter multiplied by its sum of it elements?

1 2 1                         1 2 1
2 4 2 (A)            (1/16) * 2 4 2  (B)
1 2 1                         1 2 1


Both matrices are the same except that the matrix B is multiplied by the sum of its elements. When convolved with an image, they give nearly the same blurred image.

What is the exact difference between them and when they should be used ?

• The obvious answer: the difference between the two outputs is a factor of $\frac{1}{16}$ since the filter is linear. – Jason R Apr 10 '13 at 12:47

The rightmost one (where you divide by the sum) ensures that the output of the filter wil have the same dynamic range as the input.

Actually, the output blurred images are not the same because their pixel values are different. You have the feeling that they are similar because your software (I assume Matlab) does remap the intensity values of the pixels to a range that is acceptable by typical displays, i.e., 8-bits values between 0 and 255. If you used a more "close to the metal" software or library, then you would have to do this operation by yourself.

Data dynamic range

The dynamic range of an image is given either by the min and max intensity values present in the image or by the min and max intensity that can be represented by the digital format used to store the intensity values. (From the context it is usually clear which one of the definitions is in use.)

Typical ranges are $[2,255]$ (with integer spacing) that corresponds to 8 bits quantization and $[0,1]$ for floating point values (either single or double precision). The same convention is used in Computer Graphics, OpenGL, etc.

If you take a constant image with value 1 everywhere:

• the left filter will output a constant image with value 16 everywhere,
• the second (rightmost) one produces a constant image of value 1.

From this simple example, you can see that one filter preserved the enery of the image, while the second one increased it.

While it is harmless in this case, it can lead to numerous problems in practice. For example, iterative algorithms may diverge (because of numerical overflows), your computer may run out of bits to represent your data, or you may lose precision (single and double precision floating-point values do not have a uniform precision over the range of the possible values).

• Could you please elaborate on "dynamic range" that you mentioned in your first line ? – Animesh Pandey Apr 10 '13 at 15:50