Functions
vil_gauss_filter.cxx File Reference

Functions to smooth an image. More...

#include <cmath>
#include <algorithm>
#include <functional>
#include "vil_gauss_filter.h"
#include <cassert>
#include <vnl/vnl_erf.h>
#include <vnl/vnl_double_2.h>
#include <vnl/vnl_real_polynomial.h>

Go to the source code of this file.

Functions

void vil_gauss_filter_gen_ntap (double sd, unsigned diff, std::vector< double > &filter)
 Generate an n-tap FIR filter from a Gaussian function. More...
 

Detailed Description

Functions to smooth an image.

Author
Ian Scott

Definition in file vil_gauss_filter.cxx.

Function Documentation

◆ vil_gauss_filter_gen_ntap()

void vil_gauss_filter_gen_ntap ( double  sd,
unsigned  diff,
std::vector< double > &  filter 
)

Generate an n-tap FIR filter from a Gaussian function.

The filter uses the equation $k D^d \exp -\frac{x^2}{2\sigma^2} $, where D is the differential operator, and k is a normalising constant.

Parameters
diffThe number of differential operators to apply to the filter. If you want just a normal gaussian, set diff to 0.
sdThe width of the gaussian.

The taps will be calculated using the integral of the above equation over the pixel width. However, aliasing will reduce the meaningfulness of your filter when sd << (diff+1). In most applications you will want filter.size() ~= sd*7, which will avoid significant truncation, without wasting the outer taps on near-zero values.

Definition at line 68 of file vil_gauss_filter.cxx.