FindThreshold

FindThreshold[image]

finds a global threshold value that partitions the intensity values in image into two intervals.

Details and Options

  • Thresholding is one of the most common techniques for binary clustering or segmentation.
  • FindThreshold works with 2D and 3D images as well as data arrays of any rank. It converts multichannel and color images into grayscale, and then finds a global threshold.
  • FindThreshold[image,Method->method] specifies the method to use to determine the threshold.
  • Possible settings for the Method option include:
  • {"BlackFraction",b}make a fraction b of all pixels black
    "Cluster"cluster variance maximization (Otsu's algorithm)
    "Entropy"histogram entropy minimization (Kapur's method)
    "Mean"use the mean level as the threshold
    "Median"use the median pixel level as the threshold
    "MinimumError"KittlerIllingworth minimum error thresholding method
  • The default setting is Method->"Cluster".

Examples

open allclose all

Basic Examples  (1)

Find the threshold of pixel intensities:

Use the threshold to perform an image binarization:

Scope  (3)

Find the clustering threshold for an array of data:

Find a threshold to segment a color image:

Find a threshold of a 3D volume:

Options  (5)

Method  (5)

By default, the "Cluster" method is used, maximizing variance between two clusters:

Show the histogram and computed threshold:

Use the "MinimumError" method to classify data drawn from two Gaussian distributions:

Show the histogram and computed threshold:

Use the "BlackFraction" method to specify how much of the data should be below the threshold:

Compare the threshold returned by different methods:

Compute the threshold for a color image and compare values for each method:

Applications  (1)

Find a cutoff for the vertical dimension of letters in a text image:

Select components that are longer than the cutoff:

Highlight selected components on the original image:

Wolfram Research (2010), FindThreshold, Wolfram Language function, https://reference.wolfram.com/language/ref/FindThreshold.html (updated 2012).

Text

Wolfram Research (2010), FindThreshold, Wolfram Language function, https://reference.wolfram.com/language/ref/FindThreshold.html (updated 2012).

CMS

Wolfram Language. 2010. "FindThreshold." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2012. https://reference.wolfram.com/language/ref/FindThreshold.html.

APA

Wolfram Language. (2010). FindThreshold. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FindThreshold.html

BibTeX

@misc{reference.wolfram_2024_findthreshold, author="Wolfram Research", title="{FindThreshold}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/FindThreshold.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_findthreshold, organization={Wolfram Research}, title={FindThreshold}, year={2012}, url={https://reference.wolfram.com/language/ref/FindThreshold.html}, note=[Accessed: 22-November-2024 ]}