{ } Raw JSON

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

function

skimage.filters.thresholding:threshold_yen

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

Signature

def   threshold_yen ( image = None nbins = 256 * hist = None )

Summary

Return threshold value based on Yen's method. 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.

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

Histogram from which to determine the threshold, and optionally a corresponding array of bin center intensities. An alternative use of this function is to pass it only hist.

Returns

threshold : float

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

Examples

from skimage.data import camera
image = camera()
thresh = threshold_yen(image)
binary = image <= thresh

Aliases

  • skimage.filters.threshold_yen