Kernel
Kernel
make_elliptic_kernel(size, angle=0.0)
staticmethod
Create an elliptic kernel having a certain size (defined as the semi-major axes). The kernel can be optionally rotated.
NOTE: We assume that rotation angles increase counterclockwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
ndarray
|
Kernel size (sides of the rectangle). |
required |
angle
|
float
|
Rotation angle. |
0.0
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The rows and columns of the kernel and its outline. |
make_filter(kfilter, rows, cols, **params)
staticmethod
Compute the weights that implement the specified filter from the row and column indices of the kernel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kfilter
|
KernelFilter
|
Filter type (uniform, Gaussian, etc.) |
required |
rows
|
ndarray
|
Row indices to the kernel. |
required |
cols
|
ndarray
|
Column indices of the kernel. |
required |
Raises:
| Type | Description |
|---|---|
TypeError
|
Raised if the requested kernel filter is invalid. |
Returns:
| Type | Description |
|---|---|
ndarray
|
The kernel factory function for the requested kernel filter. |
make_gabor_filter(rows, cols, angle=0.0, sd=(1.0, 1.0))
staticmethod
Weights corresponding to a Gabor filter.
TODO: Check if we can incorporate this into the Gaussian kernel method since we only have to add a couple of extra parameters and superimpose the sine funciton.
make_gaussian_filter(rows, cols, angle=0.0, sd=(1.0, 1.0), **params)
staticmethod
Weights following a 2D Gaussian distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rows
|
ndarray
|
Kernel rows. |
required |
cols
|
ndarray
|
Kernel columns. |
required |
angle
|
float
|
Kernel rotation angle. |
0.0
|
sd
|
float
|
The standard deviation (the x and y values can be specified independently). |
(1.0, 1.0)
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The normalised weights of the kernel. |
make_kernel(kshape, size, angle=0.0)
staticmethod
Create a kernel with the requested shape and angle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kshape
|
KernelShape
|
A KernelShape parameter. |
required |
size
|
ndarray
|
Kernel size (x and y extent). |
required |
angle
|
float
|
Rotation angle. |
0.0
|
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ...]
|
The kernel and its outline, each as two separate arrays |
...
|
(rows and columns). |
Raises:
| Type | Description |
|---|---|
TypeError
|
Raised if the requested kernel shape is invalid. |
make_rectangular_kernel(size, angle=0.0)
staticmethod
Create a rectangular kernel and its outline.
NOTE: We assume that rotation angles increase counterclockwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
size
|
ndarray
|
Kernel size (sides of the rectangle). |
required |
angle
|
float
|
Rotation angle. |
0.0
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The rows and columns of the kernel and its outline. |
make_uniform_filter(rows, **params)
staticmethod
Weights following a uniform distribution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rows
|
ndarray
|
Kernel rows. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
The kernel weights. |
make_von_mises_filter(rows, cols, angle=0.0, sd=(1.0, 1.0))
staticmethod
Weights corresponding to a Gabor filter.
TODO: Check if we can incorporate this into the Gaussian kernel method since we only have to add a couple of extra parameters and superimpose the sine funciton.