|
latest version v1.9 - last update 10 Apr 2010 |
|
Two-dimensional Gaussian filter kernel. More...
#include <ltiGaussKernels.h>


Public Member Functions | |
| gaussKernel2D (const int &size=3, const double &theVariance=1.4426950409) | |
| void | generate (const int &size, const double &theVariance) |
| const double & | getActualVariance () const |
Two-dimensional Gaussian filter kernel.
Gaussian kernels are separable, and will be created this way! (
You can create a "real" 2D kernel with the following code
lti::gaussKernel2D<float> gauss(5); // a kernel 5x5 with default variance lti::kernel2D<float> kern; // a 2D kernel; kern.castFrom(gauss);
but note that the convolution of this kernel with a channel is less efficient than convolving its separable version.
To convolve this filter with a channel follow the next example
// the channel to be filtered: lti::channel data; // ... initialize channel here ... // gauss filter kernel with dimensions 5x5, and a variance of 1.3 lti::gaussKernel2D<lti::channel::value_type> kernel(5,1.3); lti::convolution filter; // convolution operator lti::convolution::parameters param; // parameters param.setKernel(kernel); // use the gauss kernel filter.setParameters(param); // set parameters // filter the channel and leave the result there too filter.apply(data);
You can also use following shortcut, if you can use the default boundary type for the convolution:
// gauss filter kernel with dimensions 5x5, and a variance of 1.3 lti::gaussKernel2D<lti::channel::value_type> kernel(5,1.3); lti::convolution filter(kernel); // convolution operator // filter the channel and leave the result there too filter.apply(data);
| lti::gaussKernel2D< T >::gaussKernel2D | ( | const int & | size = 3, |
|
| const double & | theVariance = 1.4426950409 | |||
| ) |
constructor
| size | is the dimension of the one dimensional part (i.e. the filter kern is a size x size kernel!) | |
| theVariance | variance of the kernel. If negative, a default value from the given size will be computed (see lti::gaussKernel1D<T>) |
| void lti::gaussKernel2D< T >::generate | ( | const int & | size, | |
| const double & | theVariance | |||
| ) |
initialize this kernel with the specified values
| size | size of the kernel in one dimension | |
| theVariance | variance of the kernel. If negative, a default value from the given size will be computed (see lti::gaussKernel1D<T>) |
| const double& lti::gaussKernel2D< T >::getActualVariance | ( | ) | const |
Returns the actual variance used for generating the kernel.
This is helpful if a negative value was given in the generation.