2-D Mean (Obsolete) - Find mean value of each input matrix

Library

Statistics

Description

The 2-D Mean block computes the mean of each input matrix or the mean value in a sequence of inputs over time. It can also compute the mean over a particular region of interest (ROI). Use the Running mean check box to choose between the block's basic and running operation.

PortInput/OutputSupported Data TypesComplex Values Supported

Input

Vector or matrix of intensity values

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point

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

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

Yes

Rst

Scalar value

Boolean

No

ROI

  • Rectangle — [r c height width]

  • Lines — [r1 c1 r2 c2], where r1 and c1 are the row and column coordinates of the beginning of the line and r2 and c2 are the row and column coordinates of the end of the line.

  • Binary mask — Binary image matrix that enables you to specify which pixels to highlight.

Rectangles and lines —

  • Double-precision floating point

  • Single-precision floating point

  • Boolean

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

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

Binary mask —

  • Boolean

No

Label

Matrix where pixels equal to 0 represent the background, pixels equal to 1 represent the first object, pixels equal to 2 represent the second object, and so on.

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

No

Label Numbers

Vector containing the label numbers for the regions for which the block will compute the statistics.

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

No

Output/Out

Without ROI processing — Mean of each M-by-N input matrix or the mean for each element of a series of M-by-N inputs.

With ROI processing — Vector of separate statistical values for each ROI or a scalar value that represents the statistical value for all specified ROIs.

  • 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

Flag

Boolean value that indicates whether the ROI is within the image bounds or the label number is within the label matrix.

Boolean

No

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

Basic Operation

When you clear the Running mean check box, the block computes the mean of each M-by-N input matrix and outputs it from the block. The equivalent MATLAB® code is mean(u(:)), where u is the input matrix.

The mean of a complex input is computed independently for the real and imaginary components, as shown in the following figure.

Running Operation

When you select the Running mean check box, the block computes the mean for each element of a series of M-by-N inputs.

For example, suppose A is the first input to the block and B is the second and current input to the block, where

and

The block computes the mean corresponding to each element,

and outputs

For the next input, the block computes the mean for each element of the first three inputs, and so on.

Resetting the Running Mean

The block resets the running mean whenever a reset event is detected at the optional Rst port. The rate of the reset signal must be a positive integer multiple of the rate of the data signal input.

When the block is reset, the running mean associated with each element is initialized to the value in the corresponding location of the current input.

You specify the reset event using the Reset port parameter:

ROI Processing

To calculate the statistical value within a particular region of each image, select the Enable ROI processing check box. This option is not available when the block is in running mode.

Use the ROI type parameter to specify whether the ROI is a rectangle, line, label matrix, or binary mask. A binary mask is a binary image that enables you to specify which pixels to highlight, or select. In a label matrix, pixels equal to 0 represent the background, pixels equal to 1 represent the first object, pixels equal to 2 represent the second object, and so on. When the ROI type parameter is set to Label matrix, the Label and Label Numbers ports appear on the block. Use the Label Numbers port to specify the objects in the label matrix for which the block calculates statistics. The input to this port must be a vector of scalar values that correspond to the labeled regions in the label matrix. For more information about the format of the input to the ROI port when the ROI is a rectangle or a line, see the Draw Shapes block reference page.

For rectangular ROIs, use the ROI portion to process parameter to specify whether to calculate the statistical value for the entire ROI or just the ROI perimeter.

Use the Output parameter to specify the block output. The block can output separate statistical values for each ROI or the statistical value for all specified ROIs. This parameter is not available if, for the ROI type parameter, you select Binary mask.

If, for the ROI type parameter you select Rectangles or Lines, the Output flag indicating if ROI is within image bounds check box appears in the dialog box. If you select this check box, the Flag port appears on the block. The following tables describe the Flag port output based on the block parameters.

Output = Individual statistics for each ROI

Flag Port OutputDescription
0ROI is completely outside the input image.
1ROI is completely or partially inside the input image.

Output = Single statistic for all ROIs

Flag Port OutputDescription
0All ROIs are completely outside the input image.
1At least one ROI is completely or partially inside the input image.

If the ROI is partially outside the image, the block only computes the statistical values for the portion of the ROI that is within the image.

If, for the ROI type parameter you select Label matrix, the Output flag indicating if input label numbers are valid check box appears in the dialog box. If you select this check box, the Flag port appears on the block. The following tables describe the Flag port output based on the block parameters.

Output = Individual statistics for each ROI

Flag Port OutputDescription
0Label number is not in the label matrix.
1Label number is in the label matrix.

Output = Single statistic for all ROIs

Flag Port OutputDescription
0None of the label numbers are in the label matrix.
1At least one of the label numbers is in the label matrix.

Fixed-Point Data Types

The following diagram shows the data types used in the 2-D Mean block for fixed-point signals.

You can set the accumulator and output data types in the dialog box.

Dialog Box

The Main pane of the 2-D Mean dialog box appears as shown in the following figure.

Running mean

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

Reset port

Determines the reset event that causes the block to reset the running mean. The rate of the reset signal must be a positive integer multiple of the rate of the data signal input. This parameter is visible only when you select the Running mean check box.

Enable ROI processing

Select this check box to calculate the statistical value within a particular region of each image. This parameter is not available when the block is in running mode.

ROI type

Specify the type of ROI you want to use. Your choices are Rectangles, Lines, Label matrix, or Binary mask.

ROI portion to process

Specify whether you want to calculate the statistical value for the entire ROI or just the ROI perimeter. This parameter is only visible if, for the ROI type parameter, you specify Rectangles.

Output

Specify the block output. The block can output a vector of separate statistical values for each ROI or a scalar value that represents the statistical value for all the specified ROIs. This parameter is not available if, for the ROI type parameter, you select Binary mask.

Output flag indicating if ROI is within image bounds

If you select this check box, the Flag port appears on the block. For a description of the Flag port output, see the tables in ROI Processing. This parameter is visible if, for the ROI type parameter, you select Rectangles or Lines.

Output flag indicating if label numbers are valid

If you select this check box, the Flag port appears on the block. For a description of the Flag port output, see the tables in ROI Processing. This parameter is visible if, for the ROI type parameter, you select Label matrix.

The Fixed-point pane of the 2-D Mean dialog box appears as shown in the following figure.

Rounding mode

Select the rounding mode for fixed-point operations.

Overflow mode

Select the overflow mode for fixed-point operations.

Accumulator

Use this parameter to specify the accumulator word and fraction lengths:

Output

Choose how to specify the output word length and fraction length:

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

2-D Correlation

Video and Image Processing Blockset

Histogram

Video and Image Processing Blockset

Median

Video and Image Processing Blockset

Standard Deviation

Video and Image Processing Blockset

Variance

Video and Image Processing Blockset

Maximum

Signal Processing Blockset

Mean

Signal Processing Blockset

Minimum

Signal Processing Blockset

mean

MATLAB

  


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