# visionhdl.ImageStatistics

Mean, variance, and standard deviation

## Description

The `visionhdl.ImageStatistics`

System object™ calculates the mean, variance, and standard deviation of streaming video
data. The object performs each calculation over all pixels in the input region of
interest (ROI) and implements the calculations by using hardware-efficient
algorithms.

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 affect the accuracy of the mean approximation. To avoid approximation errors, use an image that contains fewer than 64 pixels, a multiple of 64 pixels up to 64

^{2}pixels, a multiple of 4096 pixels up to 64^{3}pixels, or a multiple of 64^{3}pixels up to 64^{4}pixels. For details of the mean approximation, see Algorithm.The object calculates statistics over frames up to 64

^{4}(16,777,216) pixels in size.

To calculate mean, variance, and standard deviation:

Create the

`visionhdl.ImageStatistics`

object and set its properties.Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

## Creation

### Description

returns a System object that calculates statistics from an input image region. Set
properties using one or more name-value pairs. Enclose each property name in
single quotes.`stats`

= visionhdl.ImageStatistics(`Name`

,`Value`

)

For example, when you configure the object like this, the object returns mean and standard deviation, but not variance:

stats = visionhdl.ImageStatistics('mean',true, ... 'variance',false, ... 'stdDev',true)

## Properties

## Usage

### Description

`[`

incorporates one pixel value, `mean`

,`variance`

,`stddeviation`

,`validout`

] = stats(`pixelin`

,`ctrlin`

)`pixelIn`

, into ongoing
calculations of video frame statistics. The control signals associated with each
pixel, `ctrlin`

, indicate the frame boundaries. When
`validout`

is `true`

, the output values
of `mean`

, `variance`

, and
`stddeviation`

represent the statistics for the most
recent input frame completed. The number of statistics returned depends on the
object property settings.

This object uses a streaming pixel interface with a structure
for frame control signals. The interface enables the object to operate independently of image
size and format and connect with other Vision HDL Toolbox™ objects. The object accepts pixel data as integer, fixed-point, or floating-point
data types. The object accepts control signals as a structure containing five signals. The
control signals indicate the validity of each pixel and its location in the frame. To convert a
pixel matrix into a pixel stream and control signals, use the `visionhdl.FrameToPixels`

object. For a full description of the interface, see Streaming Pixel Interface.

### Input Arguments

### Output Arguments

## Object Functions

To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named `obj`

, use
this syntax:

release(obj)

## Examples

## Algorithms

This object implements the algorithms described on the Image Statistics block reference page.

## Extended Capabilities

## Version History

**Introduced in R2015a**

## See Also

Image Statistics | `vision.Mean`

(Computer Vision Toolbox) | `vision.Variance`

(Computer Vision Toolbox) | `vision.StandardDeviation`

(Computer Vision Toolbox) | `mean2`

(Image Processing Toolbox) | `std2`

(Image Processing Toolbox) | `visionhdl.FrameToPixels`