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)

python 使用scikit 求图像局部熵

上一篇:c#撸的控制台版2048小游戏


下一篇:DataWhale-(scikit-learn教程)-Task01(线性回归与逻辑回归)-202112