This pages presents a fast Gausian blur calculation. Details of the algorithm can be read below.
First of all a sample implementation in Filtermeister code: gauss.ffp. This Gaussian Blur source code has the benefits of:
The extended binomial filter algorithm is a very simple and fast Gaussian blur algorithm where the run time per pixel is independent of the blur radius.
The Gaussian blur is a widely used filter for many effects, especially for image processing. It is important to have a fast and easy algorithm for computation. The runtime of most algorithms for calculating the Gaussian blur like the binomial sequence is proportional to the blur radius r. This disadvantage of having a complexity of O(r) per pixel makes such algorithm very slow for larger blur radii.
The extended binomial filter is an approximation of the normal binomial filter with constant complexity O(1), making the runtime per pixel independent of the blur radius. The accuracy of the approximation is chosen by the approximation degree.
A detailed description of the algorithm is available in PDF: gauss.pdf.
Some example programs of the extended binomial filter for fast Gaussian blur explain the operation of the algorithm in Filtermeister C-code.
If not other stated all example programs work with 8 and 16 bit images in any color mode.
Some programs illustrate the use of the Gaussian blur algorithm.
All source code of this site is free and could be used and modified for own applications.
This example program detects edges in images by a derivation of the Gaussian blur. Image noise for edge detection could be ignored due to adjustable blurring. The derivation is calculated as part of the extended Binomial algorithm.
Edge detection is useful in many applications. It could be used as mask for other operations like blur or sharpen to protect certain parts of the image against modification.
The short and fast version uses only the gray values of the pixel. It works only for 8-bit RGB images.
Simple edge detection source code: edgeDetection.ffp.
The long and flexible version considers all color planes separately
before summing up the edge information and works in any color mode.
Flexible edge detection source code: edgeDetection2.ffp, plugin: edgeDetection2.8bf.
This application for fast Gaussian blur is a combined blur - sharpen filter.
Blurring and sharpening have separate sliders and are applied at the same time. If both sliders have the same value of course nothing happens. The difference makes the threshold slider. If the local contrast (of the selected radius) is below the threshold only blurring is applied. For local contrast above the threshold both blur and sharpening is applied. In this way for low contrast like noise the blur filter is applied whereas higher contrast is sharpened.
Without blur this filter works the same than an USM-filter. In addition a blur could be applied.
Blur - sharpen filter source code: blursharpen.ffp, plugin: blursharpen.8bf.
The Gaussian blur filter has the effect of reducing the image's high-frequency components. Because of this low pass effect the image can be down sampled before applying the Gaussian filter. This is especially fast for larger blur radius.
The filter first does a box down-sampling, applies the normal Gaussian blur (with reduced radius) and up-samples the image again by a bilinear interpolation.
Source code of down sampled Gaussian blur filter: downsampleGauss.ffp.
An implementation by Tom Fiddaman (slightly improved) of the recursive Gaussian blur according to Young
Young et al. use a recursive implementation of the Gaussian filter which has also a runtime complexity independent of the blur radius. The disadvantage of this approach is that the length of the temporary output stream is infinite. For practical implementation the output stream has to be cut off somewhere.
Recursive Gaussian blur source code: recursivegauss.ffp, plugin: recursivegauss.8bf.
In addition to the spacial radius bilateral filter consider the pixel range for the blur calculation. This way the edges in images are preserved and not blured.
A detailed description is available at http://people.csail.mit.edu/sparis/bf_course/.
Bilateral filter source code: bilateral.ffp, plugin: bilateral.8bf.
Copyright © Alois Zingl, Vienna, Austria, Email: , last update July 2010.