python 使用scikit 求图像局部熵

2021/12/6 11:16:46

本文主要是介绍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 求图像局部熵的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程