Operator NumberOfHits

The operator NumberOfHits counts the number of matches in the binary image of kernel size N x M in the input link I and in the matching matrix. The result is output at the link O. The matching matrix is defined using parameter StructElement. An entry of '1' in the StructElement indicates that the pixel must contain the value '1' in the kernel to be included in the counting. A value '0' in the structuring element indicates that the pixel must be value '0' to be included in the counting. An entry '-1' marks don't care kernel pixels. Such pixels will be ignored during counting.

Let's have a look at an example. The following structuring element is given.

We will apply the operator to the following image I

The resulting output O is

Assume that the kernel was generated using operator FIRkernelNxM with parameter EdgeHandling = EdgeMirrored

I/O Properties

Property Value
Operator Type O
Input Link I, kernel input
Output Link O, data output

Supported Link Format

Link Parameter Input Link I Output Link O
Bit Width 1 auto1
Arithmetic unsigned as I
Parallelism any as I
Kernel Columns any 1
Kernel Rows any 1
Img Protocol {VALT_IMAGE2D, VALT_LINE1D, VALT_PIXEL0D} as I
Color Format VAF_GRAY as I
Color Flavor FL_NONE as I
Max. Img Width any as I
Max. Img Height any as I

1

The output bit width is automatically determined from the input kernel size by

Parameters

StructElement
Type static parameter
Default -1
Range {-1, 0, 1}

This parameter defines the shape of the structuring element.

  • A '0' in the struct element has to match with a '0' in the respective kernel input to increment the hit counter.

  • A '1' in the struct element has to match with a '1' in the respective kernel input to increment the hit counter.

  • A '-1' in the struct element marks the position as don't care and will be ignored.

If the input kernel size of the operator is changed, the coefficients will also change. Check the coefficients after changing the input kernel size.