當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python cucim.skimage.filters.threshold_isodata用法及代碼示例

用法:

cucim.skimage.filters.threshold_isodata(image=None, nbins=256, return_all=False, *, hist=None)

根據 ISODATA 方法返回閾值。

基於直方圖的閾值,稱為Ridler-Calvard 方法或inter-means。返回的閾值滿足以下等式:

threshold = (image[image <= threshold].mean() +
             image[image > threshold].mean()) / 2.0

也就是說,返回的閾值是將圖像分成兩組像素的強度,其中閾值強度介於這些組的平均強度之間。

對於整數圖像,上述等式在 1 以內成立;對於浮點圖像,等式在直方圖bin-width 中成立。

必須提供圖像或曆史記錄。如果給出 hist,則忽略圖像的實際直方圖。

參數

image(N, M) ndarray,可選

輸入圖像。

nbins整數,可選

用於計算直方圖的 bin 數量。對於整數數組,此值將被忽略。

return_all布爾型,可選

如果為 False(默認),則僅返回滿足上述等式的最低閾值。如果為 True,則返回所有有效閾值。

hist數組,或數組的 2 元組,可選

用於確定閾值的直方圖和相應的 bin 中心強度數組。或者,隻能通過直方圖。

返回

threshold浮點數或整數或數組

閾值。

參考

1

Ridler, TW & Calvard, S (1978), “Picture thresholding using an iterative selection method” IEEE Transactions on Systems, Man and Cybernetics 8: 630-632, DOI:10.1109/TSMC.1978.4310039

2

Sezgin M. and Sankur B. (2004) “Survey over Image Thresholding Techniques and Quantitative Performance Evaluation” Journal of Electronic Imaging, 13(1): 146-165, http://www.busim.ee.boun.edu.tr/~sankur/SankurFolder/Threshold_survey.pdf DOI:10.1117/1.1631315

3

ImageJ AutoThresholder code, http://fiji.sc/wiki/index.php/Auto_Threshold

例子

>>> from skimage.data import coins
>>> image = coins()
>>> thresh = threshold_isodata(image)
>>> binary = image > thresh

相關用法


注:本文由純淨天空篩選整理自rapids.ai大神的英文原創作品 cucim.skimage.filters.threshold_isodata。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。