Main Content

HV Counter

Count active dimensions of pixel stream

  • Library:
  • Vision HDL Toolbox / Utilities

  • HV Counter block

Description

The HV Counter block analyzes a video stream and returns the current count of lines per frame and pixels per line. The block also delays control signals of the pixel stream to correspond with the count result. Use this block for algorithms that use the location of a pixel within a frame or region of interest.

This waveform shows the pixel-stream control signals and resulting counter outputs for the first two lines of a video frame that has 10 pixels per line. The HV Counter block has a latency of two cycles to return the current counter values.

Ports

This block uses a bus for frame control signals associated with each pixel of a pixel stream. This interface enables the block to operate independently of image size and format. All Vision HDL Toolbox™ blocks use the same streaming interface. The block accepts and returns a bus containing five control signals. The control signals indicate the validity of each pixel and its location in the frame. For a full description of the interface, see Streaming Pixel Interface.

Input

expand all

Specify a pixelcontrol bus that contains five signals. The signals describe the validity of the pixel and its location in the frame. For more information, see Pixel Control Bus.

Data Types: bus

Output

expand all

Pixel location within a line, returned as a positive integer. The block clears the pixel count at the start of each line. If the input pixels per line exceeds the size of the counter, the block returns a saturated value until the start of the next line.

Data Types: fixdt(0,ceil(log2(ActiveVideoLines)),0)

Line location within the frame or region of interest, returned as a positive integer. The block clears the line count at the start of each frame. If the input lines per frame exceeds the size of the counter, the block returns a saturated value until the start of the next frame.

Data Types: fixdt(0,ceil(log2(ActiveVideoLines)),0)

Control signals associated with the pixel stream, returned as a pixelcontrol bus that contains five signals. The signals describe the validity of the pixel and its location in the frame. For more information, see Pixel Control Bus.

Data Types: bus

Parameters

expand all

Maximum pixels per line, specified as a positive integer. The block implements a pixel counter that has ceil(log2(ActivePixelsPerLine)) bits. For example, for a frame with 320 pixels per line, the counter has 9 bits. For a frame with 1024 pixels per line, the counter has 11 bits.

Maximum lines per frame, specified as a positive integer. The block implements a line counter that has ceil(log2(ActiveVideoLines)) bits. For example, for a frame with 240 pixels per line, the counter has 8 bits. For a frame with 1080 pixels per line, the counter has 11 bits.

Extended Capabilities

Introduced in R2019a