latest version v1.9 - last update 10 Apr 2010 |
Two-dimensional kernels to compute the Laplacian. More...
#include <ltiLaplacianKernel.h>
Public Member Functions | |
laplacianKernel (const int size=3) | |
void | generate (const int size) |
Two-dimensional kernels to compute the Laplacian.
The Laplacian is defined as:
This class will create a two-dimensional filter kernel that can be applied with lti::convolution to any channel, in order to compute the Laplacian of that channel.
Please note that only kernels of "float" are provided, since ubyte channels cannot represent negative values.
There are three posibilities for the kernel dimensions 3x3, 5x5 or 9x9.
The 3x3 is the standard kernel:
0 1 0 1 -4 1 0 1 0
There is another 3x3 Laplacian kernel based on a polynomial quadratic least-square-error surface passing through the 3x3 grid (this can generated giving the size "2" (from quadratic) ):
0.2 0.1 0.2 0.1 -1.2 0.1 0.2 0.1 0.2
We designed kernel with following approach:
The 5x5 and 9x9 kernels are based on the gradient operators defined by Ando in its paper "Consistent Gradient Operators" (IEEE PAMI, Vol. 22, No. 3, March 2000). With this gradients, the operators for the second derivatives are computed and added. From the 3x3 gradient kernel is generated the 5x5 Laplacian one, and from the 5x5 kernel the 9x9 Laplacian one.
These kernels are not directly separable and therefore implemented as two-dimensional ones. You can approximate the separability with the separate() methods of the sepKernel<T> class.
lti::laplacianKernel::laplacianKernel | ( | const int | size = 3 |
) |
constructor
size | is the dimension of the one dimensional part (i.e. the filter kern is a size x size kernel!) The valid values are 2, 3, 5 or 9. If an invalid value is given, an empty kernel will be created. Note that "2" generates the 3x3 "quadratic" kernel approximation. |
void lti::laplacianKernel::generate | ( | const int | size | ) |
Initialize this kernel with the specified values.
size | size of the kernel in one dimension. The valid values are 3, 5 or 9. If an invalid value is given, an empty kernel will be created. |