Autothreshold - Convert intensity image to binary image

Library

Conversions

Description

The Autothreshold block converts an intensity image to a binary image using a threshold value computed using Otsu's method.

This block computes this threshold value by splitting the histogram of the input image such that the variance of each pixel group is minimized.

PortInput/OutputSupported Data TypesComplex Values Supported

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

No

BW

Scalar, vector, or matrix that represents a binary image

Boolean

No

Th

Threshold value

Same as I port

No

EMetric

Effectiveness metric

Same as I port

No

Use the Thresholding operator parameter to specify the condition the block places on the input values. If you select > and the input value is greater than the threshold value, the block outputs 1 at the BW port; otherwise, it outputs 0. If you select <= and the input value is less than or equal to the threshold value, the block outputs 1; otherwise, it outputs 0.

Select the Output threshold check box to output the calculated threshold values at the Th port.

Select the Output effectiveness metric check box to output values that represent the effectiveness of the thresholding at the EMetric port. This metric ranges from 0 to 1. If every pixel has the same value, the effectiveness metric is 0. If the image has two pixel values or the histogram of the image pixels is symmetric, the effectiveness metric is 1.

If you clear the Specify data range check box, the block assumes that floating-point input values range from 0 to 1. To specify a different data range, select this check box. The Minimum value of input and Maximum value of input parameters appear in the dialog box. Use these parameters to enter the minimum and maximum values of your input signal.

Use the When data range is exceeded parameter to specify the block's behavior when the input values are outside the expected range. The following options are available:

If you clear the Scale threshold check box, the block uses the threshold value computed by Otsu's method to convert intensity images into binary images. If you select the Scale threshold check box, the Threshold scaling factor appears in the dialog box. Enter a scalar value. The block multiplies this scalar value with the threshold value computed by Otsu's method and uses the result as the new threshold value.

Fixed-Point Data Types

The following diagram shows the data types used in the Autothreshold block for fixed-point signals. You can use the default fixed-point parameters if your input has a word length less than or equal to 16.

In this diagram, DT means data type. You can set the product, accumulator, quotient, and effectiveness metric data types in the block mask.

Dialog Box

The Main pane of the Autothreshold dialog box appears as shown in the following figure.

Thresholding operator

Specify the condition the block places on the input matrix values. If you select > or <=, the block outputs 0 or 1 depending on whether the input matrix values are above, below, or equal to the threshold value.

Output threshold

Select this check box to output the calculated threshold values at the Th port.

Output effectiveness metric

Select this check box to output values that represent the effectiveness of the thresholding at the EMetric port.

Specify data range

If you clear this check box, the block assumes that floating-point input values range from 0 to 1. To specify a different data range, select this check box.

Minimum value of input

Enter the minimum value of your input data. This parameter is visible if you select the Specify data range check box.

Maximum value of input

Enter the maximum value of your input data. This parameter is visible if you select the Specify data range check box.

When data range is exceeded

Specify the block's behavior when the input values are outside the expected range. Your options are Ignore, Saturate, Warn and saturate, or Error. This parameter is visible if you select the Specify data range check box.

Scale threshold

Select this check box to scale the threshold value computed by Otsu's method.

Threshold scaling factor

Enter a scalar value. The block multiplies this scalar value with the threshold value computed by Otsu's method and uses the result as the new threshold value. This parameter is visible if you select the Scale threshold check box.

The Fixed-point pane of the Autothreshold dialog box appears as follows. You can use the default fixed-point parameters if your input has a word length less than or equal to 16.

Rounding mode

Select the rounding mode for fixed-point operations. This parameter does not apply to the Cast to input DT step shown in Fixed-Point Data Types. For this step, Rounding mode is always set to Nearest.

Overflow mode

Select the overflow mode for fixed-point operations.

Product 1, 2, 3, 4

As shown previously, the output of the multiplier is placed into the product output data type and scaling. Use this parameter to specify how to designate the product output word and fraction lengths.

Accumulator 1, 2, 3, 4

As shown previously, inputs to the accumulator are cast to the accumulator data type. The output of the adder remains in the accumulator data type as each element of the input is added to it. Use this parameter to specify how to designate the accumulator word and fraction lengths.

The Accumulator 3 parameter is only visible if, on the Main pane, you select the Output effectiveness metric check box.

Quotient

Choose how to specify the word length and fraction length of the quotient data type:

Eff Metric

Choose how to specify the word length and fraction length of the effectiveness metric data type. This parameter is only visible if, on the Main tab, you select the Output effectiveness metric check box.

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

Compare To Constant

Simulink

Relational Operator

Simulink

graythresh

Image Processing Toolbox

  


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