Info Node: (gsl-ref.info)Gaussian Filter

CFHT HOME gsl-ref.info: Gaussian Filter


up: Linear Digital Filters Back to Software Index

24.3.1 Gaussian Filter
----------------------

The Gaussian filter convolves the input signal with a Gaussian kernel or
window.  This filter is often used as a smoothing or noise reduction
filter.  The Gaussian kernel is defined by

     G(k) = e^{-1/2 ( \alpha k/((K-1)/2) )^2} = e^{-k^2/2\sigma^2}

for -(K-1)/2 \le k \le (K-1)/2, and K is the size of the kernel.  The
parameter \alpha specifies the number of standard deviations \sigma
desired in the kernel.  So for example setting \alpha = 3 would define a
Gaussian window of length K which spans \pm 3 \sigma.  It is often more
convenient to specify the parameter \alpha rather than the standard
deviation \sigma when constructing the kernel, since a fixed value of
\alpha would correspond to the same shape of Gaussian regardless of the
size K. The appropriate value of the standard deviation depends on K and
is related to \alpha as

     \sigma = (K - 1)/(2 \alpha)

The routines below accept \alpha as an input argument instead of \sigma.

The Gaussian filter offers a convenient way of differentiating and
smoothing an input signal in a single pass.  Using the derivative
property of a convolution,

     d/dt ( G * x ) = dG/dt * x

the input signal x(t) can be smoothed and differentiated at the same
time by convolution with a derivative Gaussian kernel, which can be
readily computed from the analytic expression above.  The same principle
applies to higher order derivatives.

 -- Function: gsl_filter_gaussian_workspace * gsl_filter_gaussian_alloc
          (const size_t K)

     This function initializes a workspace for Gaussian filtering using
     a kernel of size ‘K’.  Here, H = K / 2.  If K is even, it is
     rounded up to the next odd integer to ensure a symmetric window.
     The size of the workspace is O(K).

 -- Function: void gsl_filter_gaussian_free
          (gsl_filter_gaussian_workspace * w)

     This function frees the memory associated with ‘w’.

 -- Function: int gsl_filter_gaussian (const gsl_filter_end_t endtype,
          const double alpha, const size_t order, const gsl_vector * x,
          gsl_vector * y, gsl_filter_gaussian_workspace * w)

     This function applies a Gaussian filter parameterized by Note:
     alpha. to the input vector ‘x’, storing the output in ‘y’.
     The derivative order is specified by ‘order’, with ‘0’
     corresponding to a Gaussian, ‘1’ corresponding to a first
     derivative Gaussian, and so on.  The parameter ‘endtype’ specifies
     how the signal end points are handled.  It is allowed for ‘x’ = ‘y’
     for an in-place filter.

 -- Function: int gsl_filter_gaussian_kernel (const double alpha, const
          size_t order, const int normalize, gsl_vector * kernel)

     This function constructs a Gaussian kernel parameterized by Note:
     alpha. and stores the output in ‘kernel’.  The parameter
     ‘order’ specifies the derivative order, with ‘0’ corresponding to a
     Gaussian, ‘1’ corresponding to a first derivative Gaussian, and so
     on.  If ‘normalize’ is set to ‘1’, then the kernel will be
     normalized to sum to one on output.  If ‘normalize’ is set to ‘0’,
     no normalization is performed.


automatically generated by info2www version 1.2