latest version v1.9 - last update 10 Apr 2010 |
one-dimensional filter kernel More...
#include <ltiGaussKernels.h>
Public Member Functions | |
gaussKernel1D (const int &size=3, const double &variance=-1.0) | |
void | generate (const int &size, const double &theVariance=-1.0) |
const double & | getActualVariance () const |
one-dimensional filter kernel
This class will create a one-dimensional gaussian filter kernel.
The area under the filter will be normalized to one.
The one dimesional kernel is calculated with following equation:
Example:
// the vector to be filtered: lti::vector<channel::value_type> data; // ... initialize vector here ... // gaussian filter kernel with 3 elements, and a variance of 0.72 lti::gaussKernel1D<channel::value_type> kernel(3,0.72); lti::convolution filter; // convolution operator lti::convolution::parameters param; // parameters param.setKernel(kernel); // use the gauss kernel filter.setParameters(param); // set parameters // filter the vector and leave the result there too filter.apply(data);
lti::gaussKernel1D< T >::gaussKernel1D | ( | const int & | size = 3 , |
|
const double & | variance = -1.0 | |||
) |
constructor
size | size of the kernel in one dimension | |
variance | variance of the kernel. If this argument is ommited or a negative value is given, the variance will be calculated such that the value at the index floor(size/2) is 1/(1+floor(size/2)) times the value at index 0. For example, for size==3, the value at 1 will be 1/2 the value at 0. Hence a 3 taps kernel will contain the elements (1/4,1/2,1/4). |
void lti::gaussKernel1D< T >::generate | ( | const int & | size, | |
const double & | theVariance = -1.0 | |||
) |
initialize this kernel with the specified values
size | size of the kernel in one dimension | |
theVariance | variance of the kernel. If this argument is ommited or a negative value is given, the variance will be calculated such that the value at the index floor(size/2) is 1/(1+floor(size/2)) times the value at index 0. For example, for size==3, the value at 1 will be 1/2 the value at 0. Hence a 3 taps kernel will contain the elements (1/4,1/2,1/4). |
const double& lti::gaussKernel1D< T >::getActualVariance | ( | ) | const |
Returns the actual variance used for generating the kernel.
This is helpful if a negative value was given in the generation.