Submatrix
Module that picks a submatrix of its input. The submatrix can either be set using the parameters x0, x1, y0, y1 or using the single parameter kernel_size.
In the first case, the output will contain all elements x0 <= x < x1 && y0 <= y < y1.
In the latter case, the submatrix corresponds to the size that would be obtained if the input was processed with a filter kernel of the specified size, that is,
In this case the module can be considered as a filter that does not change its input.
If the input SHIFT is connectedm the operation is different. In this case, the module shifts the elements of a matrix the
distance in the x and y direction indicated by the input SHIFT.
x0 = (kernel_size-1)/2,
y0 = (kernel_size-1)/2,
x1 = input_size_x - (kernel_size-1)/2,
y1 = input_size_y - (kernel_size-1)/2.
Example XML definition
A simple example
<module class = "Submatrix" name = "Submatrix" x0 = "2" x1 = "4" y0 = "7" y1 = "10" />
Parameters
Name | Description | Type | Default |
---|---|---|---|
class | The class name for the module; must be "Submatrix". | string | |
name | The name of this instance of the module. | string | |
x0 | First column | int | 0 |
x1 | Last column | int | 0 |
y0 | First row | int | 0 |
y1 | Last row | int | 0 |
kernel_size | Set submatrix from this single kernel parameter | int | 0 |
offset_x | Initial shift of the matrix if SHIFT is connected | float | 0.0 |
offset_y | Initial shift of the matrix if SHIFT is connected | float | 0.0 |
direction | The direction and scaling of the shift | float | 1.0 |
Module Connections
Inputs
Name | Description |
---|---|
INPUT | The input |
SHIFT | The distance to shift the input in [X, Y] form |
Outputs
Name | Description |
---|---|
OUTPUT | The output with the submatrix |
Author
Christian Balkenius
christian.balkenius@lucs.lu.se
Lund University Cognitive Science
Files
Submatrix.h
Submatrix.cc
Submatrix.ikc