#include <Kernel.h>
Kernels are used by many algorithms that work in a neighborhood defined by some type of a kernel. Also, binary morphology operations need structuring elements that can be created by this class.
Static Public Methods | |
| template<class T> util::Matrix< T > | createCircular (int radius, T value=T(1)) |
| Create a circular kernel of values. | |
| template<class T> util::Matrix< T > | createSquare (int size, T value=T(1)) |
| Create a size-by-size square matrix with all elements set to the given value. | |
|
||||||||||||||||
|
Create a circular kernel of values. The size of the resulting matrix is (2*radius+1)-by-(2*radius+1). All items in the matrix whose spatial distance to the center is greater than radius are set to zero, and the others to the given value.
Matrix<int> mat(Kernel::createCircular(2,1));
mat = 0 0 1 0 0
0 1 1 1 0
1 1 1 1 1
0 1 1 1 0
0 0 1 0 0
|
|
||||||||||||||||
|
Create a size-by-size square matrix with all elements set to the given value. For example:
Matrix<int> mat(Kernel::createSquare(4,3));
mat = 3 3 3 3
3 3 3 3
3 3 3 3
3 3 3 3
|