md.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:website-4mb 作者: dettoman 项目源码 文件源码
def image_entropy(img):
    w,h = img.shape
    a = np.array(img.reshape((w*h,1)))
    h,e = np.histogramdd(a, bins=(16,), range=((0,256),))
    prob = h/np.sum(h) # normalize
    prob = prob[prob>0] # remove zeros
    return -np.sum(prob*np.log2(prob))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号