{ } Raw JSON

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

function

skimage.filters.thresholding:threshold_minimum

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

Signature

def   threshold_minimum ( image = None nbins = 256 max_num_iter = 10000 * hist = None )

Summary

Return threshold value based on minimum method.

Extended Summary

The histogram of the input image is computed if not provided and smoothed until there are only two maxima. Then the minimum in between is the threshold value.

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, optional

Grayscale input image.

nbins : int, optional

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

max_num_iter : int, optional

Maximum number of iterations to smooth the histogram.

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

Upper threshold value. All pixels with an intensity higher than this value are assumed to be foreground.

Raises

: RuntimeError

If unable to find two local maxima in the histogram or if the smoothing takes more than 1e4 iterations.

Examples

from skimage.data import camera
image = camera()
thresh = threshold_minimum(image)
binary = image > thresh

Aliases

  • skimage.filters.threshold_minimum