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,

        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.
    

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.

Example XML definition

A simple example

  <module
      class = "Submatrix"
      name = "Submatrix"
      x0 = "2"
      x1 = "4"
      y0 = "7"
      y1 = "10"
  />

Parameters

NameDescriptionTypeDefault
classThe class name for the module; must be "Submatrix".string
nameThe name of this instance of the module.string
x0First columnint0
x1Last columnint0
y0First rowint0
y1Last rowint0
kernel_sizeSet submatrix from this single kernel parameterint0
offset_xInitial shift of the matrix if SHIFT is connectedfloat0.0
offset_yInitial shift of the matrix if SHIFT is connectedfloat0.0
directionThe direction and scaling of the shiftfloat1.0

Module Connections

Inputs

NameDescription
INPUTThe input
SHIFTThe distance to shift the input in [X, Y] form

Outputs

NameDescription
OUTPUTThe output with the submatrix

Author

Christian Balkenius
christian.balkenius@lucs.lu.se
Lund University Cognitive Science

Files

Submatrix.h
Submatrix.cc
Submatrix.ikc

blog comments powered by Disqus