{ } Raw JSON

bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / filters / thresholding / threshold_isodata

function

skimage.filters.thresholding:threshold_isodata

source: /dev/scikit-image/src/skimage/filters/thresholding.py :467

Signature

def   threshold_isodata ( image = None nbins = 256 return_all = False * hist = None )

Summary

Return threshold value(s) based on ISODATA method.

Extended Summary

Histogram-based threshold, known as Ridler-Calvard method or inter-means. Threshold values returned satisfy the following equality

threshold = (image[image <= threshold].mean() +
             image[image > threshold].mean()) / 2.0

That is, returned thresholds are intensities that separate the image into two groups of pixels, where the threshold intensity is midway between the mean intensities of these groups.

For integer images, the above equality holds to within one; for floating- point images, the equality holds to within the histogram bin-width.

Either image or hist must be provided. In case hist is given, the actual histogram of the image is ignored.

Parameters

image : (M, N[, ...]) ndarray

Grayscale input image.

nbins : int, optional

Number of bins used to calculate histogram. This value is ignored for integer arrays.

return_all : bool, optional

If False (default), return only the lowest threshold that satisfies the above equality. If True, return all valid thresholds.

hist : array, or 2-tuple of arrays, optional

Histogram to determine the threshold from and a corresponding array of bin center intensities. Alternatively, only the histogram can be passed.

Returns

threshold : float or int or array

Threshold value(s).

Examples

from skimage.data import coins
image = coins()
thresh = threshold_isodata(image)
binary = image > thresh

Aliases

  • skimage.filters.threshold_isodata