Operator ImageNumber

Operator Library: Base

The operator ImageNumber provides the index of the current image of the input link at the output link. Thus, each pixel at the input is replaced by the index of the image i.e. the image number. The actual input pixel values are not used. The operator works as a counter which is incremented with every new image at its input. The counter is reset on the start of the process ('Multiple Processes') or after it reached it's maximum. The first image will have image index 0.

The counter width can be defined by changing the bit width of the output link O. If the counter reached it's maximum it will start from zero again = wrap around condition. For example, an output bit width of 8 bit will result in counter values between zero to 255.

Using parameter SingleShot, the operator will not be reset on the wrap around condition. The counter value output will remain at the maximum value. Thus, for an 8 bit image counter the counter value will remain at it's maximum of 255.

Often this operator is used in conjunction with operator RemoveImage to remove the first N images of a sequence.

Operator Restrictions

  • The operator supports empty images. The operator will count those empty images. However, for the empty images, the counter value cannot be provided at the output as the output of an empty frame contains no pixel. After the next non-empty image the output link will provide the correct counter value.

I/O Properties

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

Supported Link Format

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


The range of the input bit width is [1, 64]. For signed inputs, the range is [2, 64]. For unsigned color inputs, the range is [3, 63] and for signed color, the range is [6, 63].


Type static parameter
Default OFF
Range {OFF, ON}

This parameter controls the wrap around condition. When set to OFF the counter will count infinitely with each processed image, i.e. a wrap around will occur at maximum possible counter value defined by the output link bit width.

When set to ON, the counter keeps counting until the maximal possible value is reached. The counter will stop counting at it's maximum value.

Examples of Use

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