用法:
skimage.filters.threshold_multiotsu(image=None, classes=3, nbins=256, *, hist=None)
按照 Otsu 的多類方法,生成第 1 類閾值來劃分圖像中的灰度級。
選擇閾值以最大化閾值灰度級之間的成對方差的總和。有關詳細信息,請參閱注釋和[1]。
必須提供圖像或曆史記錄。如果提供 hist,則忽略圖像的實際直方圖。
- image:(N, M[, ..., P]) ndarray,可選
灰度輸入圖像。
- classes:整數,可選
要閾值的類數,即結果區域的數量。
- nbins:整數,可選
用於計算直方圖的 bin 數量。對於整數數組,此值將被忽略。
- hist:數組,或數組的 2 元組,可選
從中確定閾值的直方圖,以及可選的相應 bin 中心強度數組。如果未提供 hist,此函數將根據圖像計算它(見注釋)。
- thresh:數組
包含所需類的閾值的數組。
- ValueError
如果
image
包含的灰度值少於所需的類數。
參數:
返回:
拋出:
注意:
此實現依賴於複雜度為 的 Cython 函數,其中 是直方圖 bin 的數量,而 是所需的類數量。
如果沒有給出 hist,這個函數將使用skimage.exposure.histogram,其行為不同於np.histogram.雖然兩者都允許,但使用前者以獲得一致的行為。
輸入圖像必須是灰度的。
參考:
- 1
Liao, P-S., Chen, T-S. and Chung, P-C., “A fast algorithm for multilevel thresholding”, Journal of Information Science and Engineering 17 (5): 713-727, 2001. Available at: <https://ftp.iis.sinica.edu.tw/JISE/2001/200109_01.pdf> DOI:10.6688/JISE.2001.17.5.1
- 2
Tosa, Y., “Multi-Otsu Threshold”, a java plugin for ImageJ. Available at: <http://imagej.net/plugins/download/Multi_OtsuThreshold.java>
例子:
>>> from skimage.color import label2rgb >>> from skimage import data >>> image = data.camera() >>> thresholds = threshold_multiotsu(image) >>> regions = np.digitize(image, bins=thresholds) >>> regions_colorized = label2rgb(regions)
相關用法
- Python skimage.filters.threshold_minimum用法及代碼示例
- Python skimage.filters.threshold_mean用法及代碼示例
- Python skimage.filters.threshold_otsu用法及代碼示例
- Python skimage.filters.threshold_li用法及代碼示例
- Python skimage.filters.threshold_niblack用法及代碼示例
- Python skimage.filters.threshold_triangle用法及代碼示例
- Python skimage.filters.threshold_local用法及代碼示例
- Python skimage.filters.threshold_isodata用法及代碼示例
- Python skimage.filters.threshold_yen用法及代碼示例
- 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用法及代碼示例
- Python skimage.filters.rank.pop_bilateral用法及代碼示例
- Python skimage.filters.rank.maximum用法及代碼示例
- Python skimage.filters.roberts用法及代碼示例
- Python skimage.filters.rank.equalize用法及代碼示例
- Python skimage.filters.rank.enhance_contrast用法及代碼示例
注:本文由純淨天空篩選整理自scikit-image.org大神的英文原創作品 skimage.filters.threshold_multiotsu。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。