bundles / skimage 0.26.1rc0.dev0+git20260530.b607368ff / skimage / filters / thresholding / threshold_otsu
function
skimage.filters.thresholding:threshold_otsu
source: /dev/scikit-image/src/skimage/filters/thresholding.py :333
Signature
def threshold_otsu ( image = None , nbins = 256 , * , hist = None ) Summary
Return threshold value based on Otsu's method.
Extended Summary
Either image or hist must be provided. If hist is provided, the actual histogram of the image is ignored.
Parameters
image: (M, N[, ...]) ndarray, optionalGrayscale input image.
nbins: int, optionalNumber of bins used to calculate histogram. This value is ignored for integer arrays.
hist: array, or 2-tuple of arrays, optionalHistogram from which to determine the threshold, and optionally a corresponding array of bin center intensities. If no hist provided, this function will compute it from the image.
Returns
threshold: floatUpper threshold value. All pixels with an intensity higher than this value are assumed to be foreground.
Notes
The input image must be grayscale.
Examples
from skimage.data import camera image = camera() thresh = threshold_otsu(image) binary = image <= thresh✓
Aliases
-
skimage.filters.threshold_otsu