資源簡介
計算二維圖像信息熵
代碼片段和文件信息
#?-*-?coding:?utf-8?-*-
“““
Created?on?Sun?Apr?28?10:12:20?2019
@author:?宣
“““
from?skimage?import?iocolor
import?numpy?as?np
import?math
img?=?io.imread(‘E:\lena24__.bmp‘)
gray?=?color.rgb2gray(img)
#io.imshow(gray)
#print(img)
width?=?img.shape[0]
height?=?img.shape[1]
toll?=?img.size
print(‘圖像的大小為:{}*{}‘.format(widthheight))
levelcount?=?[]
psb?=?[]
#計算概率保留小數n位
n=4
def?plogp(count):
????add?=?[]
????for?i?in?range(len(count)):
????????if?count[i]==0:
????????????add.
評論
共有 條評論