用法:
skimage.filters.threshold_li(image, *, tolerance=None, initial_guess=None, iter_callback=None)
通過 Li 的迭代最小交叉熵方法計算閾值。
- image:(N, M[, ..., P]) ndarray
灰度輸入圖像。
- tolerance:浮點數,可選
當一次迭代中閾值的變化小於該值時,完成計算。默認情況下,這是
image
中強度值之間最小差異的一半。- initial_guess:float 或 Callable[[array[float]], float], 可選
Li 的迭代方法使用梯度下降來找到最佳閾值。如果圖像強度直方圖包含兩個以上的模式(峰值),則梯度下降可能會陷入局部最優。迭代的初始猜測可以幫助算法找到globally-optimal 閾值。一個浮點值定義了一個特定的起點,而一個可調用對象應該接受一個圖像強度數組並返回一個浮點值。示例有效的可調用對象包括
numpy.mean
(默認)、lambda arr: numpy.quantile(arr, 0.95)
,甚至是skimage.filters.threshold_otsu()
- iter_callback:可調用[[浮點],任意],可選
在算法的每次迭代中將在閾值上調用的函數。
- threshold:浮點數
上閾值。強度高於此值的所有像素都被假定為前景。
參數:
返回:
參考:
- 1
Li C.H. and Lee C.K. (1993) “Minimum Cross Entropy Thresholding” Pattern Recognition, 26(4): 617-625 DOI:10.1016/0031-3203(93)90115-D
- 2
Li C.H. and Tam P.K.S. (1998) “An Iterative Algorithm for Minimum Cross Entropy Thresholding” Pattern Recognition Letters, 18(8): 771-776 DOI:10.1016/S0167-8655(98)00057-9
- 3
Sezgin M. and Sankur B. (2004) “Survey over Image Thresholding Techniques and Quantitative Performance Evaluation” Journal of Electronic Imaging, 13(1): 146-165 DOI:10.1117/1.1631315
- 4
ImageJ AutoThresholder code, http://fiji.sc/wiki/index.php/Auto_Threshold
例子:
>>> from skimage.data import camera >>> image = camera() >>> thresh = threshold_li(image) >>> binary = image > thresh
相關用法
- Python skimage.filters.threshold_local用法及代碼示例
- Python skimage.filters.threshold_otsu用法及代碼示例
- Python skimage.filters.threshold_niblack用法及代碼示例
- Python skimage.filters.threshold_triangle用法及代碼示例
- 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_li。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。