编程语言
首页 > 编程语言> > python 使用scikit 求图像局部熵

python 使用scikit 求图像局部熵

作者:互联网

entropy
求局部熵,熵是使用基为2的对数运算出来的。该函数将局部区域的灰度值分布进行二进制编码,返回编码的最小值。
函数格式:

entropy(image, selem)

selem表示结构化元素,用于设定滤波器。

from skimage import data,color
import matplotlib.pyplot as plt
from skimage.morphology import disk
import skimage.filters.rank as sfr
img =color.rgb2gray(data.lena())
dst =sfr.entropy(img, disk(5)) #半径为5的圆形滤波器
plt.figure('filters',figsize=(8,8))
plt.subplot(121)
plt.title('origin image')
plt.imshow(img,plt.cm.gray)
plt.subplot(122)
plt.title('filted image')
plt.imshow(dst,plt.cm.gray)

在这里插入图片描述

标签:plt,img,python,image,scikit,entropy,图像,import,skimage
来源: https://blog.csdn.net/qq_42473140/article/details/121742225