Products & Services Solutions Academia Support User Community Company

Learn more about Video and Image Processing Blockset   

2-D Histogram (Obsolete) - Generate histogram of each input matrix

Library

Statistics

Description

The 2-D Histogram block computes the frequency distribution of the elements in each input matrix or in a sequence of inputs over a period of time. Use the Running histogram check box to select between the block's basic and running operation.

The output of the 2-D Histogram block is different than the output of the imhist function in the Image Processing Toolbox. For intensity images, the imhist function defines the pth bin boundaries as

where A is maximum value of the data type, N is the number of bins in the histogram, and p starts from 1. The 2-D Histogram block defines bin boundaries as

where A corresponds to the Maximum value of input parameter and the Minimum value of input parameter is assumed to be 0.

PortInput/OutputSupported Data TypesComplex Values Supported

Input / I

Vector or matrix of intensity values

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point

  • 8-, 16-, and 32-bit signed integer

  • 8-, 16-, and 32-bit unsigned integer

Yes

Rst

Signal that triggers a reset event

  • Double-precision floating point

  • Single-precision floating point

  • Boolean

  • 8-, 16-, and 32-bit signed integer

  • 8-, 16-, and 32-bit unsigned integer

No

Output

Sample-based 1-by-N vector that represents the frequency distribution of each M-by-N input matrix or the frequency distributions in a series of M-by-N inputs

Same as Input port

No

Length-M 1-D vector inputs are treated as M-by-1 column vectors.

The block sorts the elements of each input matrix into the number of discrete bins, n, specified by the Number of bins parameter. Complex inputs are sorted by their magnitude squared values.

The histogram value for a given bin represents the frequency of occurrence of the input values bracketed by that bin. You specify the upper boundary of the highest-valued bin in the Maximum value of input parameter, BM, and the lower boundary of the lowest-valued bin in the Minimum value of input parameter, Bm. The bins have equal width of

where n is the number of bins. The centers are located at

Input values that fall on the border between two bins are sorted into the lower-valued bin; that is, each bin includes its upper boundary. For example, a bin of width 4 centered on the value 5 contains the input value 7, but not the input value 3. Input values greater than the Maximum value of input parameter or less than Minimum value of input parameter are sorted into the highest-valued or lowest-valued bin, respectively. The values you enter for the Maximum value of input and Minimum value of input parameters must be real-valued scalar values.

Basic Operation

If you clear the Running histogram check box, the block computes the frequency distribution of each M-by-N input matrix and outputs a sample-based 1-by-N vector.

For example, if your input is and you set the block parameters as follows:

The block outputs [3 3 3 0].

If you select the Normalized check box, the block scales each element of the output so that sum(v) is 1, where v is the output vector.

Running Operation

If you select the Running histogram check box, the block computes the frequency distributions in a series of M-by-N inputs.

For example, if your first input is , your second and current input is , and you set the block parameters as follows:

The block outputs [3 6 6 3]. For the next input, the block computes the frequency distribution for the first three inputs, and so on.

Resetting the Running Histogram

The block resets the running histogram whenever a reset event is detected at the optional Rst port. The reset signal and the input data signal must be the same rate.

To enable the Rst port, select the Reset port parameter. You specify the reset event in the Trigger type parameter, and can be one of the following:

Dialog Box

The Main pane of the 2-D Histogram dialog box:

Minimum value of input

Enter a real-valued scalar value for the lower boundary, , of the lowest-valued bin. Tunable.

Maximum value of input

Enter a real-valued scalar value for the upper boundary, , of the highest-valued bin. Tunable.

Number of bins

Enter the number of bins, n, in the histogram.

Normalized

If you select this check box, the block normalizes the output vector (1-norm). Tunable.

Use of this parameter is not supported for fixed-point signals.

Running histogram

Select this check box to enable the block's running histogram operation.

Reset port

Enables the Rst input port when selected. The reset signal and the input data signal must be the same rate. This parameter is visible if you select the Running histogram check box.

Trigger type

The type of event that resets the running histogram. For more information, see Resetting the Running Histogram. This parameter is enabled only when you set the Reset port parameter.

The Fixed-point pane of the 2-D Histogram dialog box:

Rounding mode

Select the rounding mode for fixed-point operations.

Overflow mode

Select the overflow mode for fixed-point operations.

Product output

Use this parameter to specify how to designate the product output word and fraction lengths:

  • When you select Same as input, these characteristics match those of the input to the block.

  • When you select Binary point scaling, you can enter the word length and the fraction length of the product output, in bits.

  • When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the product output. This block requires power-of-two slope and a bias of 0.

Accumulator

Use this parameter to specify the accumulator word and fraction lengths resulting from a complex-complex multiplication in the block:

  • When you select Same as product output, these characteristics match those of the product output.

  • When you select Same as input, these characteristics match those of the input to the block.

  • When you select Binary point scaling, you can enter the word length and the fraction length of the accumulator, in bits.

  • When you select Slope and bias scaling, you can enter the word length, in bits, and the slope of the accumulator. This block requires power-of-two slope and a bias of 0.

Lock scaling against changes by the autoscaling tool

Select this parameter to prevent any fixed-point scaling you specify in this block mask from being overridden by the autoscaling tool in the Fixed-Point Tool. For more information, see fxptdlg, a reference page on the Fixed-Point Tool in the Simulink documentation.

See Also

2-D Autocorrelation

Video and Image Processing Blockset software

2-D Correlation

Video and Image Processing Blockset software

Mean

Video and Image Processing Blockset software

Median

Video and Image Processing Blockset software

Standard Deviation

Video and Image Processing Blockset software

Variance

Video and Image Processing Blockset software

Histogram

Signal Processing Blockset software

Maximum

Signal Processing Blockset software

Minimum

Signal Processing Blockset software

hist

MATLAB application

imhist

Image Processing Toolbox software

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS