Main Content


Frequency distribution of pixel values in video stream

  • Library:
  • Vision HDL Toolbox / Statistics

  • Histogram block


The Histogram block computes the frequency distribution of pixel values in a video stream. You can configure the number and size of the bins. The block provides a read interface for accessing each bin. The block keeps a running histogram until you reset the bin values.


This block uses a streaming pixel interface with a bus for frame control signals. 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 a scalar pixel value and a bus that contains five control signals. The control signals indicate the validity of each pixel and its location in the frame. To convert a frame (pixel matrix) into a pixel stream and control signals, use the Frame To Pixels block. For a full description of the interface, see Streaming Pixel Interface.


expand all

Single image pixel, specified as an unsigned integer scalar value.

double and single data types are supported for simulation, but not for HDL code generation.

Data Types: single | double | uint | fixdt(0,N,0)

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

The block captures this value each cycle that the readRdy output port is 1 (true). The data type is fixdt(0,N,0), N = 5,6,...,12. The word length must be log2(Number of bins).

Data Types: fixdt(0,N,0)

A binReset value of 1 (true) triggers a RAM initialization sequence that resets the histogram bin values. Reset takes NumBins cycles to clear all locations. Input signals are ignored during this interval.

Data Types: Boolean


expand all

When readRdy is 1 (true), the histogram bins are ready to read. The block returns readRdy set to 1 (true) two cycles after the final pixel of a frame.

Data Types: Boolean

Histogram bin value corresponding to the requested address, binAddr. The Data type parameter specifies the data type for this value.

Data Types: fixed point

When validOut is 1 (true), the histogram bin value, hist, is valid.

Data Types: Boolean


expand all

Choose the number of bins depending on the input word length (WL). If the number of bins is less than 2WL, the block truncates the least-significant bits of each pixel. If the number of bins is greater than 2WL, some bins are not used, and after you synthesize your design it will use more hardware resources than necessary.

Data type of histogram bin values.

double and single data types are supported for simulation, but not for HDL code generation.

Word length of the histogram bins. If a bin overflows, the count saturates and the block shows a warning.


This parameter applies when you set Data type to Unsigned fixed point.


expand all

Extended Capabilities

See Also




  • (Image Processing Toolbox)
Introduced in R2015a