用法:
skimage.measure.shannon_entropy(image, base=2)
計算圖像的香農熵。
香農熵定義為 S = -sum(pk * log(pk)),其中 pk 是值為 k 的像素的頻率/概率。
- image:(N, M) ndarray
灰度輸入圖像。
- base:浮點數,可選
要使用的對數底。
- entropy:浮點數
參數:
返回:
注意:
對於 base=2,返回值以位或香農 (Sh) 為單位,對於 base=np.e,以自然單位 (nat) 為單位,對於 base=10,以哈特利 (Hart) 為單位。
參考:
- 1
- 2
例子:
>>> from skimage import data >>> from skimage.measure import shannon_entropy >>> shannon_entropy(data.camera()) 7.231695011055706
相關用法
- Python skimage.measure.ransac用法及代碼示例
- Python skimage.measure.profile_line用法及代碼示例
- Python skimage.measure.perimeter_crofton用法及代碼示例
- Python skimage.measure.moments_hu用法及代碼示例
- Python skimage.measure.moments_coords_central用法及代碼示例
- Python skimage.measure.LineModelND用法及代碼示例
- Python skimage.measure.block_reduce用法及代碼示例
- Python skimage.measure.moments用法及代碼示例
- Python skimage.measure.moments_normalized用法及代碼示例
- Python skimage.measure.euler_number用法及代碼示例
- Python skimage.measure.perimeter用法及代碼示例
- Python skimage.measure.moments_central用法及代碼示例
- Python skimage.measure.EllipseModel用法及代碼示例
- Python skimage.measure.regionprops用法及代碼示例
- Python skimage.measure.find_contours用法及代碼示例
- Python skimage.measure.CircleModel用法及代碼示例
- Python skimage.measure.label用法及代碼示例
- Python skimage.measure.regionprops_table用法及代碼示例
- Python skimage.measure.moments_coords用法及代碼示例
- Python skimage.metrics.hausdorff_distance用法及代碼示例
注:本文由純淨天空篩選整理自scikit-image.org大神的英文原創作品 skimage.measure.shannon_entropy。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。