Main Content

Calculate mean, variance, and standard deviation

**Library:**Vision HDL Toolbox / Statistics

The Image Statistics block calculates the mean, variance, and standard deviation of streaming video data. Each calculation is performed over all pixels in the input region of interest (ROI). The block implements the calculations by using hardware-efficient algorithms.

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.

To change the size and dimensions of the ROI, you can manipulate the input video stream control signals. See Regions of Interest.

The number of valid pixels in the input image affects the accuracy of the mean approximation. To avoid approximation error, use an image that contains a multiple of 64

^{n}pixels, up to 64^{n+1}pixels, where*n*equals 0, 1, 2, or 3. For details of the mean approximation, see Algorithm.The block calculates statistics over frames up to 64

^{4}(16, 777, 216) pixels in size. This size supports HD frames.

2-D
Mean (Computer Vision Toolbox) | 2-D
Variance (Computer Vision Toolbox) | 2-D
Standard Deviation (Computer Vision Toolbox) | Frame To Pixels | `visionhdl.ImageStatistics`