用法:
skimage.filters.threshold_otsu(image=None, nbins=256, *, hist=None)
根據 Otsu 的方法返回閾值。
必須提供圖像或曆史記錄。如果提供 hist,則忽略圖像的實際直方圖。
- image:(N, M[, ..., P]) ndarray,可選
灰度輸入圖像。
- nbins:int 可選
用於計算直方圖的 bin 數量。對於整數數組,此值將被忽略。
- hist:數組,或數組的 2 元組,可選
從中確定閾值的直方圖,以及可選的相應 bin 中心強度數組。如果未提供 hist,則此函數將從圖像中計算它。
- threshold:浮點數
上閾值。強度高於此值的所有像素都被假定為前景。
參數:
返回:
注意:
輸入圖像必須是灰度的。
參考:
- 1
Wikipedia, https://en.wikipedia.org/wiki/Otsu’s_Method
例子:
>>> from skimage.data import camera >>> image = camera() >>> thresh = threshold_otsu(image) >>> binary = image <= thresh
相關用法
- Python skimage.filters.threshold_li用法及代碼示例
- Python skimage.filters.threshold_niblack用法及代碼示例
- Python skimage.filters.threshold_triangle用法及代碼示例
- Python skimage.filters.threshold_local用法及代碼示例
- Python skimage.filters.threshold_minimum用法及代碼示例
- Python skimage.filters.threshold_isodata用法及代碼示例
- Python skimage.filters.threshold_mean用法及代碼示例
- Python skimage.filters.threshold_yen用法及代碼示例
- Python skimage.filters.threshold_multiotsu用法及代碼示例
- Python skimage.filters.threshold_sauvola用法及代碼示例
- Python skimage.filters.try_all_threshold用法及代碼示例
- Python skimage.filters.unsharp_mask用法及代碼示例
- Python skimage.filters.rank.noise_filter用法及代碼示例
- Python skimage.filters.gaussian用法及代碼示例
- Python skimage.filters.rank.sum用法及代碼示例
- Python skimage.filters.window用法及代碼示例
- Python skimage.filters.gabor用法及代碼示例
- Python skimage.filters.rank.autolevel用法及代碼示例
- Python skimage.filters.rank.pop用法及代碼示例
- Python skimage.filters.rank.mean用法及代碼示例
注:本文由純淨天空篩選整理自scikit-image.org大神的英文原創作品 skimage.filters.threshold_otsu。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。