HOME

TheInfoList



OR:

In image processing, a Gaussian blur (also known as Gaussian smoothing) is the result of blurring an
image An image is a visual representation of something. It can be two-dimensional, three-dimensional, or somehow otherwise feed into the visual system to convey information. An image can be an artifact, such as a photograph or other two-dimensiona ...
by a
Gaussian function In mathematics, a Gaussian function, often simply referred to as a Gaussian, is a function of the base form f(x) = \exp (-x^2) and with parametric extension f(x) = a \exp\left( -\frac \right) for arbitrary real constants , and non-zero . It is ...
(named after mathematician and scientist
Carl Friedrich Gauss Johann Carl Friedrich Gauss (; german: Gauß ; la, Carolus Fridericus Gauss; 30 April 177723 February 1855) was a German mathematician and physicist who made significant contributions to many fields in mathematics and science. Sometimes refer ...
). It is a widely used effect in graphics software, typically to reduce
image noise Image noise is random variation of brightness or color information in images, and is usually an aspect of electronic noise. It can be produced by the image sensor and circuitry of a scanner or digital camera. Image noise can also originate in ...
and reduce detail. The visual effect of this blurring technique is a smooth blur resembling that of viewing the image through a translucent screen, distinctly different from the
bokeh In photography, bokeh ( or ; ) is the aesthetic quality of the blur produced in out-of-focus parts of an image. Bokeh has also been defined as "the way the lens renders out-of-focus points of light". Differences in lens aberrations and ...
effect produced by an out-of-focus lens or the shadow of an object under usual illumination. Gaussian smoothing is also used as a pre-processing stage in computer vision algorithms in order to enhance image structures at different scales—see
scale space representation Scale-space theory is a framework for multi-scale signal representation developed by the computer vision, image processing and signal processing communities with complementary motivations from physics and biological vision. It is a formal th ...
and
scale space implementation In the areas of computer vision, image analysis and signal processing, the notion of scale-space representation is used for processing measurement data at multiple scales, and specifically enhance or suppress image features over different ranges o ...
.


Mathematics

Mathematically, applying a Gaussian blur to an image is the same as convolving the image with a
Gaussian function In mathematics, a Gaussian function, often simply referred to as a Gaussian, is a function of the base form f(x) = \exp (-x^2) and with parametric extension f(x) = a \exp\left( -\frac \right) for arbitrary real constants , and non-zero . It is ...
. This is also known as a two-dimensional
Weierstrass transform In mathematics, the Weierstrass transform of a function , named after Karl Weierstrass, is a "smoothed" version of obtained by averaging the values of , weighted with a Gaussian centered at ''x''. Specifically, it is the function define ...
. By contrast, convolving by a circle (i.e., a circular
box blur A box blur (also known as a box linear filter) is a spatial domain linear filter in which each pixel in the resulting image has a value equal to the average value of its neighboring pixels in the input image. It is a form of low-pass ("blurring") f ...
) would more accurately reproduce the
bokeh In photography, bokeh ( or ; ) is the aesthetic quality of the blur produced in out-of-focus parts of an image. Bokeh has also been defined as "the way the lens renders out-of-focus points of light". Differences in lens aberrations and ...
effect. Since the Fourier transform of a Gaussian is another Gaussian, applying a Gaussian blur has the effect of reducing the image's high-frequency components; a Gaussian blur is thus a
low-pass filter A low-pass filter is a filter that passes signals with a frequency lower than a selected cutoff frequency and attenuates signals with frequencies higher than the cutoff frequency. The exact frequency response of the filter depends on the filt ...
. The Gaussian blur is a type of image-blurring filter that uses a Gaussian function (which also expresses the
normal distribution In statistics, a normal distribution or Gaussian distribution is a type of continuous probability distribution for a real-valued random variable. The general form of its probability density function is : f(x) = \frac e^ The parameter \mu ...
in statistics) for calculating the
transformation Transformation may refer to: Science and mathematics In biology and medicine * Metamorphosis, the biological process of changing physical form after birth or hatching * Malignant transformation, the process of cells becoming cancerous * Tran ...
to apply to each
pixel In digital imaging, a pixel (abbreviated px), pel, or picture element is the smallest addressable element in a raster image, or the smallest point in an all points addressable display device. In most digital display devices, pixels are the ...
in the image. The formula of a Gaussian function in one dimension is G(x) = \frac e^ In two dimensions, it is the product of two such Gaussian functions, one in each dimension: Shapiro, L. G. & Stockman, G. C: "Computer Vision", page 137, 150. Prentice Hall, 2001Mark S. Nixon and Alberto S. Aguado. ''Feature Extraction and Image Processing''. Academic Press, 2008, p. 88.R.A. Haddad and A.N. Akansu,
A Class of Fast Gaussian Binomial Filters for Speech and Image Processing
" IEEE Transactions on Acoustics, Speech, and Signal Processing, vol. 39, pp 723-727, March 1991.
G(x,y) = \frac e^ where ''x'' is the distance from the origin in the horizontal axis, ''y'' is the distance from the origin in the vertical axis, and ''σ'' is the standard deviation of the Gaussian distribution. It is important to note that the origin on these axes are at the center (0, 0). When applied in two dimensions, this formula produces a surface whose
contour Contour may refer to: * Contour (linguistics), a phonetic sound * Pitch contour * Contour (camera system), a 3D digital camera system * Contour, the KDE Plasma 4 interface for tablet devices * Contour line, a curve along which the function ha ...
s are
concentric circles In geometry, two or more objects are said to be concentric, coaxal, or coaxial when they share the same center or axis. Circles, regular polygons and regular polyhedra, and spheres may be concentric to one another (sharing the same center poi ...
with a Gaussian distribution from the center point. Values from this distribution are used to build a
convolution In mathematics (in particular, functional analysis), convolution is a mathematical operation on two functions ( and ) that produces a third function (f*g) that expresses how the shape of one is modified by the other. The term ''convolution'' ...
matrix which is applied to the original image. This convolution process is illustrated visually in the figure on the right. Each pixel's new value is set to a
weighted average The weighted arithmetic mean is similar to an ordinary arithmetic mean (the most common type of average), except that instead of each of the data points contributing equally to the final average, some data points contribute more than others. The ...
of that pixel's neighborhood. The original pixel's value receives the heaviest weight (having the highest Gaussian value) and neighboring pixels receive smaller weights as their distance to the original pixel increases. This results in a blur that preserves boundaries and edges better than other, more uniform blurring filters; see also
scale space implementation In the areas of computer vision, image analysis and signal processing, the notion of scale-space representation is used for processing measurement data at multiple scales, and specifically enhance or suppress image features over different ranges o ...
. In theory, the Gaussian function at every point on the image will be non-zero, meaning that the entire image would need to be included in the calculations for each pixel. In practice, when computing a discrete approximation of the Gaussian function, pixels at a distance of more than 3''σ'' have a small enough influence to be considered effectively zero. Thus contributions from pixels outside that range can be ignored. Typically, an image processing program need only calculate a matrix with dimensions \lceil6\sigma\rceil × \lceil 6\sigma \rceil (where \lceil \cdot \rceil is the
ceiling function In mathematics and computer science, the floor function is the function that takes as input a real number , and gives as output the greatest integer less than or equal to , denoted or . Similarly, the ceiling function maps to the least int ...
) to ensure a result sufficiently close to that obtained by the entire Gaussian distribution. In addition to being circularly symmetric, the Gaussian blur can be applied to a two-dimensional image as two independent one-dimensional calculations, and so is termed a
separable filter Separability may refer to: Mathematics * Separable algebra, a generalization to associative algebras of the notion of a separable field extension * Separable differential equation, in which separation of variables is achieved by various means ...
. That is, the effect of applying the two-dimensional matrix can also be achieved by applying a series of single-dimensional Gaussian matrices in the horizontal direction, then repeating the process in the vertical direction. In computational terms, this is a useful property, since the calculation can be performed in O\left(w_\text w_\text h_\text\right) + O\left(h_\text w_\text h_\text\right) time (where ''h'' is height and ''w'' is width; see Big O notation), as opposed to O\left(w_\text h_\text w_\text h_\text\right) for a non-separable kernel. Applying successive Gaussian blurs to an image has the same effect as applying a single, larger Gaussian blur, whose radius is the square root of the sum of the squares of the blur radii that were actually applied. For example, applying successive Gaussian blurs with radii of 6 and 8 gives the same results as applying a single Gaussian blur of radius 10, since \sqrt = 10. Because of this relationship, processing time cannot be saved by simulating a Gaussian blur with successive, smaller blurs — the time required will be at least as great as performing the single large blur. Gaussian blurring is commonly used when reducing the size of an image. When
downsampling In digital signal processing, downsampling, compression, and decimation are terms associated with the process of ''resampling'' in a multi-rate digital signal processing system. Both ''downsampling'' and ''decimation'' can be synonymous with ''com ...
an image, it is common to apply a low-pass filter to the image prior to resampling. This is to ensure that spurious high-frequency information does not appear in the downsampled image (
aliasing In signal processing and related disciplines, aliasing is an effect that causes different signals to become indistinguishable (or ''aliases'' of one another) when sampled. It also often refers to the distortion or artifact that results when ...
). Gaussian blurs have nice properties, such as having no sharp edges, and thus do not introduce ringing into the filtered image.


Low-pass filter

Gaussian blur is a
low-pass filter A low-pass filter is a filter that passes signals with a frequency lower than a selected cutoff frequency and attenuates signals with frequencies higher than the cutoff frequency. The exact frequency response of the filter depends on the filt ...
, attenuating high frequency signals.R.A. Haddad and A.N. Akansu,
A Class of Fast Gaussian Binomial Filters for Speech and Image Processing
" IEEE Transactions on Acoustics, Speech, and Signal Processing, vol. 39, pp 723-727, March 1991.
Its amplitude Bode plot (the
log scale A logarithmic scale (or log scale) is a way of displaying numerical data over a very wide range of values in a compact way—typically the largest numbers in the data are hundreds or even thousands of times larger than the smallest numbers. Such a ...
in the
frequency domain In physics, electronics, control systems engineering, and statistics, the frequency domain refers to the analysis of mathematical functions or signals with respect to frequency, rather than time. Put simply, a time-domain graph shows how a s ...
) is a
parabola In mathematics, a parabola is a plane curve which is Reflection symmetry, mirror-symmetrical and is approximately U-shaped. It fits several superficially different Mathematics, mathematical descriptions, which can all be proved to define exact ...
.


Variance reduction

How much does a Gaussian filter with standard deviation \sigma_f smooth the picture? In other words, how much does it reduce the standard deviation of pixel values in the picture? Assume the grayscale pixel values have a standard deviation \sigma_X, then after applying the filter the reduced standard deviation \sigma_r can be approximated as \sigma_r \approx \frac.


Sample Gaussian matrix

This sample matrix is produced by sampling the Gaussian filter kernel (with σ = 0.84089642) at the midpoints of each pixel and then normalizing. The center element (at , 0 has the largest value, decreasing symmetrically as distance from the center increases. Since the filter kernel's origin is at the center, the matrix starts at G(-R, -R) and ends at G(R, R) where R equals the kernel radius. \begin 0.00000067 & 0.00002292 & \textbf & 0.00038771 & \textbf & 0.00002292 & 0.00000067 \\ 0.00002292 & 0.00078633 & 0.00655965 & 0.01330373 & 0.00655965 & 0.00078633 & 0.00002292 \\ \textbf & 0.00655965 & 0.05472157 & 0.11098164 & 0.05472157 & 0.00655965 & \textbf \\ 0.00038771 & 0.01330373 & 0.11098164 & \textbf & 0.11098164 & 0.01330373 & 0.00038771 \\ \textbf & 0.00655965 & 0.05472157 & 0.11098164 & 0.05472157 & 0.00655965 & \textbf \\ 0.00002292 & 0.00078633 & 0.00655965 & 0.01330373 & 0.00655965 & 0.00078633 & 0.00002292 \\ 0.00000067 & 0.00002292 & \textbf & 0.00038771 & \textbf & 0.00002292 & 0.00000067 \end The element 0.22508352 (the central one) is 1177 times larger than 0.00019117 which is just outside 3σ.


Implementation

A Gaussian blur effect is typically generated by convolving an image with an FIR kernel of Gaussian values. In practice, it is best to take advantage of the Gaussian blur’s separable property by dividing the process into two passes. In the first pass, a one-dimensional kernel is used to blur the image in only the horizontal or vertical direction. In the second pass, the same one-dimensional kernel is used to blur in the remaining direction. The resulting effect is the same as convolving with a two-dimensional kernel in a single pass, but requires fewer calculations. Discretization is typically achieved by sampling the Gaussian filter kernel at discrete points, normally at positions corresponding to the midpoints of each pixel. This reduces the computational cost but, for very small filter kernels, point sampling the Gaussian function with very few samples leads to a large error. In these cases, accuracy is maintained (at a slight computational cost) by integration of the Gaussian function over each pixel's area.Erik Reinhard. ''High dynamic range imaging: Acquisition, Display, and Image-Based Lighting''. Morgan Kaufmann, 2006, pp. 233–234. When converting the Gaussian’s continuous values into the discrete values needed for a kernel, the sum of the values will be different from 1. This will cause a darkening or brightening of the image. To remedy this, the values can be normalized by dividing each term in the kernel by the sum of all terms in the kernel. The efficiency of FIR breaks down for high sigmas. Alternatives to the FIR filter exist. These include the very fast multiple
box blur A box blur (also known as a box linear filter) is a spatial domain linear filter in which each pixel in the resulting image has a value equal to the average value of its neighboring pixels in the input image. It is a form of low-pass ("blurring") f ...
s, the fast and accurate IIR
Deriche edge detector Deriche edge detector is an edge detection operator developed by Rachid Deriche in 1987. It is a multistep algorithm used to obtain an optimal result of edge detection in a discrete two-dimensional image. This algorithm is based on John F. Canny ...
, a "stack blur" based on the box blur, and more.


Common uses


Edge detection

Gaussian smoothing is commonly used with
edge detection Edge detection includes a variety of mathematical methods that aim at identifying edges, curves in a digital image at which the image brightness changes sharply or, more formally, has discontinuities. The same problem of finding discontinuitie ...
. Most edge-detection algorithms are sensitive to noise; the 2-D Laplacian filter, built from a discretization of the Laplace operator, is highly sensitive to noisy environments. Using a Gaussian Blur filter before edge detection aims to reduce the level of noise in the image, which improves the result of the following edge-detection algorithm. This approach is commonly referred to as Laplacian of Gaussian, or LoG filtering.


Photography

Lower-end
digital camera A digital camera is a camera that captures photographs in digital memory. Most cameras produced today are digital, largely replacing those that capture images on photographic film. Digital cameras are now widely incorporated into mobile devices ...
s, including many
mobile phone A mobile phone, cellular phone, cell phone, cellphone, handphone, hand phone or pocket phone, sometimes shortened to simply mobile, cell, or just phone, is a portable telephone that can make and receive calls over a radio frequency link whil ...
cameras, commonly use gaussian blurring to obscure
image noise Image noise is random variation of brightness or color information in images, and is usually an aspect of electronic noise. It can be produced by the image sensor and circuitry of a scanner or digital camera. Image noise can also originate in ...
caused by higher ISO light sensitivities. Gaussian blur is automatically applied as part of the image post-processing of the photo by the camera software, leading to an irreversible loss of detail.


See also

*
Difference of Gaussians In imaging science, difference of Gaussians (DoG) is a feature enhancement algorithm that involves the subtraction of one Gaussian blurred version of an original image from another, less blurred version of the original. In the simple case of grays ...
*
Image noise Image noise is random variation of brightness or color information in images, and is usually an aspect of electronic noise. It can be produced by the image sensor and circuitry of a scanner or digital camera. Image noise can also originate in ...
*
Gaussian filter In electronics and signal processing mainly in digital signal processing, a Gaussian filter is a filter whose impulse response is a Gaussian function (or an approximation to it, since a true Gaussian response would have infinite impulse respons ...
*
Gaussian pyramid Pyramid, or pyramid representation, is a type of multi-scale signal representation developed by the computer vision, image processing and signal processing communities, in which a signal or an image is subject to repeated smoothing and subsam ...
*
Infinite impulse response Infinite impulse response (IIR) is a property applying to many linear time-invariant systems that are distinguished by having an impulse response h(t) which does not become exactly zero past a certain point, but continues indefinitely. This is in ...
(IIR) *
Scale space implementation In the areas of computer vision, image analysis and signal processing, the notion of scale-space representation is used for processing measurement data at multiple scales, and specifically enhance or suppress image features over different ranges o ...
*
Median filter The median filter is a non-linear digital filtering technique, often used to remove noise from an image or signal. Such noise reduction is a typical pre-processing step to improve the results of later processing (for example, edge detection on an ...
*
Weierstrass transform In mathematics, the Weierstrass transform of a function , named after Karl Weierstrass, is a "smoothed" version of obtained by averaging the values of , weighted with a Gaussian centered at ''x''. Specifically, it is the function define ...


Notes and references


External links


GLSL implementation of a separable gaussian blur filter
*Example fo
Gaussian blur (low-pass filtering) applied to a wood-block print and an etching
in order to remove details for picture comparison. *Mathematic

function * OpenCV (C++

function {{DEFAULTSORT:Gaussian Blur Image processing Gaussian function Image noise reduction techniques