Gaussian filter

Last updated
Shape of the impulse response of a typical Gaussian filter Gaussian Filter.svg
Shape of the impulse response of a typical 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 response). Gaussian filters have the properties of having no overshoot to a step function input while minimizing the rise and fall time. This behavior is closely connected to the fact that the Gaussian filter has the minimum possible group delay. A Gaussian filter will have the best combination of suppression of high frequencies while also minimizing spatial spread, being the critical point of the uncertainty principle. These properties are important in areas such as oscilloscopes [1] and digital telecommunication systems. [2]

Contents

Mathematically, a Gaussian filter modifies the input signal by convolution with a Gaussian function; this transformation is also known as the Weierstrass transform.

Definition

The one-dimensional Gaussian filter has an impulse response given by

and the frequency response is given by the Fourier transform

with the ordinary frequency. These equations can also be expressed with the standard deviation as parameter

and the frequency response is given by

By writing as a function of with the two equations for and as a function of with the two equations for it can be shown that the product of the standard deviation and the standard deviation in the frequency domain is given by

,

where the standard deviations are expressed in their physical units, e.g. in the case of time and frequency in seconds and hertz, respectively.

In two dimensions, it is the product of two such Gaussians, one per direction:

[3] [4] [5]

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.

Synthesizing Gaussian filter polynomials

The Gaussian transfer function polynomials may be synthesized using a Taylor series expansion of the square of Gaussian function of the form where is set such that (equivalent of -3.01dB) at . [6] The value of may be calculated with this constraint to be , or 0.34657359 for an approximate -3.010 dB cutoff attenuation. If an attenuation of other than -3.010 dB is desired, may be recalculated using a different attenuation, .

To meet all above criteria, must be of the form obtained below, with no stop band zeros,

To complete the transfer function, may be approximated with a Taylor Series expansion about 0. The full Taylor series for is shown below. [6]

The ability of the filter to simulate a true Gaussian function depends on how many terms are taken from the series. The number of terms taken beyond 0 establishes the order N of the filter.

For the frequency axis, is replace with .

Since only half the poles are located in the left half plane, selecting only those poles to build the transfer function also serves to square root the equation, as is seen above.

Simple 3rd order example

A 3rd order Gaussian filter with a -3.010 dB cutoff attenuation at = 1 requires the use of terms k=0 to k=3 in the Taylor series to produce the squared Gaussian function.

Absorbing into the coefficients, factoring using a root finding algorithm, and building the polynomials using only the left half plane poles yields the transfer function for a third order Gaussian filter with the required -3.010 dB cutoff attenuation.

A quick sanity check of evaluating yields a magnitude of -2.986 dB, which represents an error of only ~0.8% from the desired -3.010 dB. This error will decrease as the number of orders increases. In addition, the error at higher frequencies will be more pronounced for all Gaussian filters, bug will also decrease as the order of the filter increases. [6]

Gaussian Transitional Filters

Although Gaussian filters exhibit desirable group delay, as described in the opening description, the steepness of the cutoff attenuation may be less than desired. [7] To work around this, tables have been developed and published that preserve the desirable Gaussian group delay response ant the lower and mid frequencies, and then switch to a higher steepness Chebyshev attenuation at the higher frequencies [7] .

Digital implementation

The Gaussian function is for and would theoretically require an infinite window length. However, since it decays rapidly, it is often reasonable to truncate the filter window and implement the filter directly for narrow windows, in effect by using a simple rectangular window function. In other cases, the truncation may introduce significant errors. Better results can be achieved by instead using a different window function; see scale space implementation for details.

Filtering involves convolution. The filter function is said to be the kernel of an integral transform. The Gaussian kernel is continuous. Most commonly, the discrete equivalent is the sampled Gaussian kernel that is produced by sampling points from the continuous Gaussian. An alternate method is to use the discrete Gaussian kernel [8] which has superior characteristics for some purposes. Unlike the sampled Gaussian kernel, the discrete Gaussian kernel is the solution to the discrete diffusion equation.

Since the Fourier transform of the Gaussian function yields a Gaussian function, the signal (preferably after being divided into overlapping windowed blocks) can be transformed with a fast Fourier transform, multiplied with a Gaussian function and transformed back. This is the standard procedure of applying an arbitrary finite impulse response filter, with the only difference being that the Fourier transform of the filter window is explicitly known.

Due to the central limit theorem (from statistics), the Gaussian can be approximated by several runs of a very simple filter such as the moving average. The simple moving average corresponds to convolution with the constant B-spline (a rectangular pulse). For example, four iterations of a moving average yield a cubic B-spline as a filter window, which approximates the Gaussian quite well. A moving average is quite cheap to compute, so levels can be cascaded quite easily.

In the discrete case, the filter's standard deviations (in the time and frequency domains) are related by

where the standard deviations are expressed in a number of samples and N is the total number of samples. The standard deviation of a filter can be interpreted as a measure of its size. The cut-off frequency of a Gaussian filter might be defined by the standard deviation in the frequency domain:

where all quantities are expressed in their physical units. If is measured in samples, the cut-off frequency (in physical units) can be calculated with

where is the sample rate. The response value of the Gaussian filter at this cut-off frequency equals exp(−0.5)  0.607.

However, it is more common to define the cut-off frequency as the half power point: where the filter response is reduced to 0.5 (−3 dB) in the power spectrum, or 1/2 ≈ 0.707 in the amplitude spectrum (see e.g. Butterworth filter). For an arbitrary cut-off value 1/c for the response of the filter, the cut-off frequency is given by

[9]

For c = 2 the constant before the standard deviation in the frequency domain in the last equation equals approximately 1.1774, which is half the Full Width at Half Maximum (FWHM) (see Gaussian function). For c = 2 this constant equals approximately 0.8326. These values are quite close to 1.

A simple moving average corresponds to a uniform probability distribution and thus its filter width of size has standard deviation . Thus the application of successive moving averages with sizes yield a standard deviation of

(Note that standard deviations do not sum up, but variances do.)

A gaussian kernel requires values, e.g. for a of 3, it needs a kernel of length 17. A running mean filter of 5 points will have a sigma of . Running it three times will give a of 2.42. It remains to be seen where the advantage is over using a gaussian rather than a poor approximation.

When applied in two dimensions, this formula produces a Gaussian surface that has a maximum at the origin, whose contours are concentric circles with the origin as center. A two-dimensional convolution matrix is precomputed from the formula and convolved with two-dimensional data. Each element in the resultant matrix new value is set to a weighted average of that element's neighborhood. The focal element receives the heaviest weight (having the highest Gaussian value), and neighboring elements receive smaller weights as their distance to the focal element increases. In Image processing, each element in the matrix represents a pixel attribute such as brightness or color intensity, and the overall effect is called Gaussian blur.

The Gaussian filter is non-causal, which means the filter window is symmetric about the origin in the time domain. This makes the Gaussian filter physically unrealizable. This is usually of no consequence for applications where the filter bandwidth is much larger than the signal. In real-time systems, a delay is incurred because incoming samples need to fill the filter window before the filter can be applied to the signal. While no amount of delay can make a theoretical Gaussian filter causal (because the Gaussian function is non-zero everywhere), the Gaussian function converges to zero so rapidly that a causal approximation can achieve any required tolerance with a modest delay, even to the accuracy of floating point representation.

Applications

See also

Related Research Articles

The bilinear transform is used in digital signal processing and discrete-time control theory to transform continuous-time system representations to discrete-time and vice versa.

In engineering, a transfer function of a system, sub-system, or component is a mathematical function that models the system's output for each possible input. It is widely used in electronic engineering tools like circuit simulators and control systems. In simple cases, this function can be represented as a two-dimensional graph of an independent scalar input versus the dependent scalar output. Transfer functions for components are used to design and analyze systems assembled from components, particularly using the block diagram technique, in electronics and control theory.

<span class="mw-page-title-main">Cutoff frequency</span> Frequency response boundary

In physics and electrical engineering, a cutoff frequency, corner frequency, or break frequency is a boundary in a system's frequency response at which energy flowing through the system begins to be reduced rather than passing through.

<span class="mw-page-title-main">Full width at half maximum</span> Concept in statistics and wave theory

In a distribution, full width at half maximum (FWHM) is the difference between the two values of the independent variable at which the dependent variable is equal to half of its maximum value. In other words, it is the width of a spectrum curve measured between those points on the y-axis which are half the maximum amplitude. Half width at half maximum (HWHM) is half of the FWHM if the function is symmetric. The term full duration at half maximum (FDHM) is preferred when the independent variable is time.

<span class="mw-page-title-main">Window function</span> Function used in signal processing

In signal processing and statistics, a window function is a mathematical function that is zero-valued outside of some chosen interval. Typically, windows functions are symmetric around the middle of the interval, approach a maximum in the middle, and taper away from the middle. Mathematically, when another function or waveform/data-sequence is "multiplied" by a window function, the product is also zero-valued outside the interval: all that is left is the part where they overlap, the "view through the window". Equivalently, and in actual practice, the segment of data within the window is first isolated, and then only that data is multiplied by the window function values. Thus, tapering, not segmentation, is the main purpose of window functions.

In mathematics, a Gaussian function, often simply referred to as a Gaussian, is a function of the base form

A resistor–capacitor circuit, or RC filter or RC network, is an electric circuit composed of resistors and capacitors. It may be driven by a voltage or current source and these will produce different responses. A first order RC circuit is composed of one resistor and one capacitor and is the simplest type of RC circuit.

Chebyshev filters are analog or digital filters that have a steeper roll-off than Butterworth filters, and have either passband ripple or stopband ripple. Chebyshev filters have the property that they minimize the error between the idealized and the actual filter characteristic over the operating frequency range of the filter, but they achieve this with ripples in the passband. This type of filter is named after Pafnuty Chebyshev because its mathematical characteristics are derived from Chebyshev polynomials. Type I Chebyshev filters are usually referred to as "Chebyshev filters", while type II filters are usually called "inverse Chebyshev filters". Because of the passband ripple inherent in Chebyshev filters, filters with a smoother response in the passband but a more irregular response in the stopband are preferred for certain applications.

In signal processing, a finite impulse response (FIR) filter is a filter whose impulse response is of finite duration, because it settles to zero in finite time. This is in contrast to infinite impulse response (IIR) filters, which may have internal feedback and may continue to respond indefinitely.

<span class="mw-page-title-main">Wave packet</span> Short "burst" or "envelope" of restricted wave action that travels as a unit

In physics, a wave packet is a short burst of localized wave action that travels as a unit, outlined by an envelope. A wave packet can be analyzed into, or can be synthesized from, a potentially-infinite set of component sinusoidal waves of different wavenumbers, with phases and amplitudes such that they interfere constructively only over a small region of space, and destructively elsewhere. Any signal of a limited width in time or space requires many frequency components around a center frequency within a bandwidth inversely proportional to that width; even a gaussian function is considered a wave packet because its Fourier transform is a "packet" of waves of frequencies clustered around a central frequency. Each component wave function, and hence the wave packet, are solutions of a wave equation. Depending on the wave equation, the wave packet's profile may remain constant or it may change while propagating.

<span class="mw-page-title-main">Butterworth filter</span> Type of signal processing filter

The Butterworth filter is a type of signal processing filter designed to have a frequency response that is as flat as possible in the passband. It is also referred to as a maximally flat magnitude filter. It was first described in 1930 by the British engineer and physicist Stephen Butterworth in his paper entitled "On the Theory of Filter Amplifiers".

<span class="mw-page-title-main">Comb filter</span> Signal processing filter

In signal processing, a comb filter is a filter implemented by adding a delayed version of a signal to itself, causing constructive and destructive interference. The frequency response of a comb filter consists of a series of regularly spaced notches in between regularly spaced peaks giving the appearance of a comb.

<span class="mw-page-title-main">Gaussian blur</span> Type of image blur produced by a Gaussian function

In image processing, a Gaussian blur is the result of blurring an image by a Gaussian function.

An elliptic filter is a signal processing filter with equalized ripple (equiripple) behavior in both the passband and the stopband. The amount of ripple in each band is independently adjustable, and no other filter of equal order can have a faster transition in gain between the passband and the stopband, for the given values of ripple. Alternatively, one may give up the ability to adjust independently the passband and stopband ripple, and instead design a filter which is maximally insensitive to component variations.

In electronics and signal processing, a Bessel filter is a type of analog linear filter with a maximally flat group delay, which preserves the wave shape of filtered signals in the passband. Bessel filters are often used in audio crossover systems.

<span class="mw-page-title-main">Optimum "L" filter</span>

The Optimum "L" filter was proposed by Athanasios Papoulis in 1958. It has the maximum roll off rate for a given filter order while maintaining a monotonic frequency response. It provides a compromise between the Butterworth filter which is monotonic but has a slower roll off and the Chebyshev filter which has a faster roll off but has ripple in either the passband or stopband. The filter design is based on Legendre polynomials which is the reason for its alternate name and the "L" in Optimum "L".

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 grayscale images, the blurred images are obtained by convolving the original grayscale images with Gaussian kernels having differing width. Blurring an image using a Gaussian kernel suppresses only high-frequency spatial information. Subtracting one image from the other preserves spatial information that lies between the range of frequencies that are preserved in the two blurred images. Thus, the DoG is a spatial band-pass filter that attenuates frequencies in the original grayscale image that are far from the band center.

<span class="mw-page-title-main">Gabor transform</span>

The Gabor transform, named after Dennis Gabor, is a special case of the short-time Fourier transform. It is used to determine the sinusoidal frequency and phase content of local sections of a signal as it changes over time. The function to be transformed is first multiplied by a Gaussian function, which can be regarded as a window function, and the resulting function is then transformed with a Fourier transform to derive the time-frequency analysis. The window function means that the signal near the time being analyzed will have higher weight. The Gabor transform of a signal x(t) is defined by this formula:

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 of scale. A special type of scale-space representation is provided by the Gaussian scale space, where the image data in N dimensions is subjected to smoothing by Gaussian convolution. Most of the theory for Gaussian scale space deals with continuous images, whereas one when implementing this theory will have to face the fact that most measurement data are discrete. Hence, the theoretical problem arises concerning how to discretize the continuous theory while either preserving or well approximating the desirable theoretical properties that lead to the choice of the Gaussian kernel. This article describes basic approaches for this that have been developed in the literature.

The Frenkel–Kontorova model, also known as the FK model, is a fundamental model of low-dimensional nonlinear physics.

References

  1. Orwiler, Bob (1969). Oscilloscope Vertical Amplifiers (PDF) (1 ed.). Beaverton, Oregon: Tektronix Circuit Concepts. Archived (PDF) from the original on 14 October 2011. Retrieved 17 November 2022.
  2. Andrews, James R (1999). "Low-Pass Risetime Filters for Time Domain Applications" (PDF). kh6htv.com. Picosecond Pulse Labs. Archived (PDF) from the original on 21 July 2016. Retrieved 17 November 2022.
  3. 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.
  4. Shapiro, L. G. & Stockman, G. C: "Computer Vision", page 137, 150. Prentence Hall, 2001
  5. Mark S. Nixon and Alberto S. Aguado. Feature Extraction and Image Processing. Academic Press, 2008, p. 88.
  6. 1 2 3 Zverev, Anatol I. (1967). Handbook of Filter Synthesis. New York, Chichester, Brisbane, Toronto, Singapore: John Wiley & Sons, Inc. pp. 70, 71. ISBN   0 471 98680 1.{{cite book}}: CS1 maint: date and year (link)
  7. 1 2 Williams, Arthur Bernard; Taylor, Fred J. (1995). Electronic Filter Design Handbook (3rd ed.). US: McGraw-Hill, Inc. pp. 2.56, 2.65, 11.62. ISBN   0-07-070441-4.
  8. Lindeberg, T., "Scale-space for discrete signals," PAMI(12), No. 3, March 1990, pp. 234–254.
  9. Stefano Bottacchi, Noise and Signal Interference in Optical Fiber Transmission Systems, p. 242, John Wiley & Sons, 2008 ISBN   047051681X