A Survey of Gaussian Convolution Algorithms

A firstorder recursive filter approximation, computed inplace. More...
A firstorder recursive filter approximation, computed inplace.
This code implements Alvarez and Mazorra's recursive filter approximation of Gaussian convolution. The Gaussian is approximated by a cascade of firstorder recursive filters,
Functions  
void  am_gaussian_conv (num *dest, const num *src, long N, long stride, double sigma, int K, num tol, int use_adjusted_q) 
Gaussian convolution with AlvarezMazorra. More...  
void  am_gaussian_conv_image (num *dest, const num *src, int width, int height, int num_channels, num sigma, int K, num tol, int use_adjusted_q) 
2D Gaussian convolution with AlvarezMazorra More...  
void am_gaussian_conv  (  num *  dest, 
const num *  src,  
long  N,  
long  stride,  
double  sigma,  
int  K,  
num  tol,  
int  use_adjusted_q  
) 
Gaussian convolution with AlvarezMazorra.
dest  output convolved data 
src  input data, modified inplace if src = dest 
N  number of elements 
stride  stride between successive samples 
sigma  standard deviation of the Gaussian in pixels 
K  number of passes (larger implies better accuracy) 
tol  accuracy in evaluating left boundary sum 
use_adjusted_q  if nonzero, use proposed regression for q 
Implements the fast approximate Gaussian convolution algorithm of Alvarez and Mazorra, where the Gaussian is approximated by K passes of a first order causal filter and a firstorder anticausal filter,
Boundaries are handled with halfsample symmetric extension, and tol
specifies the accuracy for approximating an infinite sum on the left boundary.
Gaussian convolution is approached as approximating the heat equation and each timestep is performed with an efficient recursive computation. Using more steps yields a more accurate approximation of the Gaussian. Reasonable values for the parameters are K
= 4, tol
= 1e3.
The convolution can be performed inplace by setting src
= dest
(the source array is overwritten with the result).
Definition at line 81 of file gaussian_conv_am.c.
void am_gaussian_conv_image  (  num *  dest, 
const num *  src,  
int  width,  
int  height,  
int  num_channels,  
num  sigma,  
int  K,  
num  tol,  
int  use_adjusted_q  
) 
2D Gaussian convolution with AlvarezMazorra
dest  output convolved data 
src  input, modified inplace if src = dest 
width,height,num_channels  the image dimensions 
sigma  Gaussian standard deviation 
K  number of passes 
tol  accuracy for left boundary sum 
use_adjusted_q  if nonzero, use proposed q 
Similar to am_gaussian_conv(), this routine approximates 2D Gaussian convolution with AlvarezMazorra recursive filtering.
The convolution can be performed inplace by setting src
= dest
(the source array is overwritten with the result).
Definition at line 159 of file gaussian_conv_am.c.