Table Of Contents

Threshold (Multiple Auto Threshold) (G Dataflow)

Last Modified: June 25, 2019

Computes the optimal values to threshold an image into a given number of classes.

This algorithm uses a variant of the classification by clustering method. Starting from a random sort, a clustering algorithm is iterated until a stable and reliable result is found. Use the Multiple Threshold node or the User Lookup node to threshold an image based on the optimal threshold range computed.

connector_pane_image
datatype_icon

image in

Reference to the source image.

datatype_icon

image mask

8-bit image specifying the region in the image to use for the calculation.

Only those pixels in the original image that correspond to an equivalent non-zero pixel in the mask image are used for the calculation. The entire image is used in the calculation if image mask is not connected.

datatype_icon

number of classes

Number of desired phases.

This algorithm uses a clustering method and can use any value between 2 and 256.

Default: 2

datatype_icon

error in

Error conditions that occur before this node runs.

The node responds to this input according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Default: No error

datatype_icon

image out

Reference to image in.

datatype_icon

lookup table

Array containing the values of the 256 transformed elements encoded between 0 and (n - 1), where n is the number of classes.

You can connect this array to the User Lookup node to perform a threshold operation directly.

datatype_icon

threshold parameters

Array output containing the number of classes compatible with the Multiple Threshold node.

The results range from 0 to (n - 1), where n is the number of classes.

datatype_icon

lower value

Lowest pixel value to be taken into account during a threshold.

datatype_icon

upper value

Highest pixel value to be taken into account during a threshold.

datatype_icon

replace value

Value used to replace pixels between the lower value and upper value.

This operation requires that keep/replace value? is True.

datatype_icon

keep/replace value?

Input determining whether to replace the value of the pixels existing in the range between lower value and upper value.

All pixels outside the range between lower value and upper value are set to 0. All values found between this range are replaced by the value entered in replace value if keep/replace value? is True.

True Replaces the pixel values between lower value and upper value.
False Keeps the original pixel values between lower value and upper value.

Default: True

datatype_icon

error out

Error information.

The node produces this output according to standard error behavior.

Standard Error Behavior

Many nodes provide an error in input and an error out output so that the node can respond to and communicate errors that occur while code is running. The value of error in specifies whether an error occurred before the node runs. Most nodes respond to values of error in in a standard, predictable way.

error in does not contain an error error in contains an error
If no error occurred before the node runs, the node begins execution normally.

If no error occurs while the node runs, it returns no error. If an error does occur while the node runs, it returns that error information as error out.

If an error occurred before the node runs, the node does not execute. Instead, it returns the error in value as error out.

Threshold Outputs

This method is based on an iterated measurement of an histogram. After finding the best result, the histogram is segmented into n groups. These groups are based on the fact that each point in a group is closer to the barycenter of its own group than the other group. The node outputs the threshold data in two forms:

  • A LUT directly usable by the User Lookup node
  • An array directly usable by the Multiple Threshold node

Where This Node Can Run:

Desktop OS: Windows

FPGA: Not supported

Web Server: Not supported in VIs that run in a web application


Recently Viewed Topics