# 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
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.5632269978523254, "perplexity": 417.23050725842876}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2020-10/segments/1581875145729.69/warc/CC-MAIN-20200222211056-20200223001056-00350.warc.gz"}