Python图像高级滤波之最大值滤波
1、打开IDLE:IDLE是Pythonshell界面,如图所示。
2、载入工具包:在Python中要实现某一个代码需要载入相关的软件包才可以实现。from skimage import data,col泠贾高框orimport matplotlib.pyplot as pltfrom skimage.morphology import diskimport skimage.filters.rank as sfr
3、读取图片:读取自己要处理的图片,并且将图片进行灰度化处理,这里读取skimage包内的图片。img=color.rgb2gray(data.coffee())
4、滤波处理:采用以下代码对图片进行最大值滤波处理。dst =sfr.maximum(img, disk(5))
5、查看效果:采用下面语句来查看我们滤波后的图片。plt.figure('filters')plt.subplot(121)plt.imshow(img,plt.cm.gray)plt.subplot(122)plt.imshow(dst,plt.cm.gray)plt.show()
6、滤波结果:
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:56
阅读量:78
阅读量:90
阅读量:32
阅读量:28