A Survey of Gaussian Convolution Algorithms

Approximation by finite impulse response filtering. More...
Approximation by finite impulse response filtering.
This code approximates Gaussian convolution with finite impulse response (FIR) filtering. By truncating the Gaussian to a finite support, Gaussian convolution is approximated by
The process to use these functions is the following:
Data Structures  
struct  fir_coeffs_ 
Coefficients for FIR Gaussian approximation. More...  
Typedefs  
typedef struct fir_coeffs_  fir_coeffs 
Coefficients for FIR Gaussian approximation.  
Functions  
static num *  make_g_trunc (num sigma, long r) 
Construct truncated Gaussian filter for FIR convolution. More...  
static void  conv_sym (num *dest, const num *src, long N, long stride, const num *h, long r) 
Convolution with a symmetric filter. More...  
int  fir_precomp (fir_coeffs *c, double sigma, num tol) 
Precompute filter coefficients for FIR filtering. More...  
void  fir_gaussian_conv (fir_coeffs c, num *dest, const num *src, long N, long stride) 
FIR Gaussian convolution. More...  
void  fir_gaussian_conv_image (fir_coeffs c, num *dest, num *buffer, const num *src, int width, int height, int num_channels) 
FIR filtering approximation of 2D Gaussian convolution. More...  
void  fir_free (fir_coeffs *c) 
Release memory associated with fir_coeffs struct. More...  

static 
Convolution with a symmetric filter.
dest  destination (must be distinct from src) 
src  source signal 
N  signal length 
stride  stride between successive src and dest samples 
h  symmetric filter, an array of length r + 1 
r  radius of filter h 
This routine computes the convolution of src
and h
according to
where src
is extrapolated with halfsample symmetry.
Definition at line 82 of file gaussian_conv_fir.c.
void fir_free  (  fir_coeffs *  c  ) 
Release memory associated with fir_coeffs struct.
c  fir_coeffs created by fir_precomp() 
Definition at line 197 of file gaussian_conv_fir.c.
void fir_gaussian_conv  (  fir_coeffs  c, 
num *  dest,  
const num *  src,  
long  N,  
long  stride  
) 
FIR Gaussian convolution.
c  fir_coeffs created by fir_precomp() 
dest  output convolved data (must be distinct from src) 
src  data to be convolved 
N  number of samples 
stride  stride between successive samples 
This routine approximates 1D Gaussian convolution with the FIR filter. The computation itself is performed by conv_sym().
src
and dest
must be distinct. Definition at line 137 of file gaussian_conv_fir.c.
void fir_gaussian_conv_image  (  fir_coeffs  c, 
num *  dest,  
num *  buffer,  
const num *  src,  
int  width,  
int  height,  
int  num_channels  
) 
FIR filtering approximation of 2D Gaussian convolution.
c  fir_coeffs created by fir_precomp() 
dest  destination image 
buffer  array with at least width samples 
src  source image, must be distinct from dest 
width  image width 
height  image height 
num_channels  number of image channels 
Similar to fir_gaussian_conv(), this routine performs 2D FIRbased Gaussian convolution.
Definition at line 158 of file gaussian_conv_fir.c.
int fir_precomp  (  fir_coeffs *  c, 
double  sigma,  
num  tol  
) 
Precompute filter coefficients for FIR filtering.
c  fir_coeffs pointer to hold precomputed coefficients 
sigma  Gaussian standard deviation 
tol  filter accuracy (smaller tol implies larger filter) 
This routine calls make_g_trunc() to construct the truncated Gaussian FIR filter. The radius of the filter is determined such that
By Young's inequality, the error between convolution using this truncated FIR filter and exact Gaussian convolution is bounded,
Definition at line 117 of file gaussian_conv_fir.c.
Construct truncated Gaussian filter for FIR convolution.
sigma  Gaussian standard deviation 
r  radius of the filter 
This routine constructs a truncated Gaussian for a specified radius r
,
The filter should be released by the caller with free()
.
Definition at line 43 of file gaussian_conv_fir.c.