Operator Count

Operator Library: Accumulator

This up and down counter counts all pixels with value "1" at input I. It accepts only 1-bit pixel input. It is possible to define an initialization value, a direction (count up/count down), and an automatic clear strategy (end-of-line/end-of-frame reset) as parameters. Additionally, it is possible to reset the counter manually through the ClrI input link.

Depending on the AutoClear strategy, the output bit width is determined by the image width or image size.

The output frame has the same size as the input frame. For every input pixel, the operator will output the current counter value. The counter wraps around if the counter reaches maximum in count-up mode or zero in count-down mode.

The following example shows the relation of input values to output values. In this example the AutoClear strategy is set to EoL (end-of-line). The initialization value Init is "0".

This operator is commonly used with Logic operators.

Operator Restrictions

  • Empty Images

    Empty Images, i.e. images with no pixels are allowed. The operator will output an empty image.

  • Image Size

    All lines of each input image may have varying lengths but must not be empty.

I/O Properties

Property Value
Operator Type O
Input Links I, Image Input
ClrI, Clear Input
Output Link O, Data Output

Supported Link Format

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

1

The output bit width is automatically determined from the input image dimensions and the parameter settings. Output bit width for image protocol VALT_IMAGE2D and parameter AutoClear = EoL or image protocol VALT_LINE1D:

Output bit width for image protocol VALT_IMAGE2D and parameter AutoClear = EoF or image protocol VALT_PIXEL0D:

When image protocol VALT_PIXEL0D is used or AutoClear is set to None, the output bit width can be adjusted directly at the output link O.

The output bit width must not exceed 64 Bit.

Parameters

AutoClear
Type static parameter
Default EoL
Range {EoL, EoF, None}

This parameter defines when to reset the counter to its initial value define by parameter Init.

The parameter cannot be set to EoF if image protocol VALT_LINE1D is used. It is disabled for image protocol VALT_PIXEL0D.

Init
Type static parameter
Default 0
Range [0, 2^OutputBitWidth - 1]

This parameter defines the initial value. The counter is set to its initial value at

  • start-up
  • CltI = 1
  • AutoClear condition

Direction
Type static parameter
Default UP
Range {UP, DOWN}

This parameter defines whether the counter is incremented (UP) or decremented (DOWN) for each value '1' at the input link I.

Examples of Use

The use of operator Count is shown in the following examples:

  • 'Hardware Test'

    An example for hardware self test of DMA, RAM, GPIOs, Trigger and LEDs.

  • 'Image Grayscale Scope'

    Example - For debugging purposes the Scope operator provides options for analyzing gray-scale pictures. .