Python图像高级滤波处理之对比度增强算法
1、打开Python shell:
2、载入工具包:
载入要使用到的工具包,代码如下(若是报错说明可能没安装先关的工具包),
from skimage import data,color
import matplotlib.pyplot as plt
from skimage.morphology import disk
import skimage.filters.rank as sfr
3、读入一个图片:
读入我们要处理的图片,代码如下,这里读取的是工具包中自带的图片,
img=color.rgb2gray(data.coffee())
4、对图片进行滤波:
可采用以下方法进行滤波,也就是我们的文中所给的方法,
auto =sfr.enhance_contrast(img, disk(5))
5、显示效果:
采用下面的代码显示我们的效果。
plt.figure('filters')
plt.subplot(121)
plt.imshow(img,plt.cm.gray)
plt.subplot(122)
plt.imshow(auto,plt.cm.gray)
plt.show()
6、结果:
可得到我们的结果如下。
声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:46
阅读量:104
阅读量:174
阅读量:43
阅读量:68