最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Python图像处理模块ndimage用法实例分析
时间:2019-09-05 编辑:袖梨 来源:一聚教程网
本篇文章小编给大家分享一下Python图像处理模块ndimage用法实例分析,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看。
一 原始图像
1 代码
from scipy import misc from scipy import ndimage import matplotlib.pyplot as plt face = misc.face()#face是测试图像之一 plt.figure()#创建图形 plt.imshow(face)#绘制测试图像 plt.show()#原始图像
2 运行结果
二 高斯滤波
1 代码
from scipy import misc from scipy import ndimage import matplotlib.pyplot as plt face = misc.face()#face是测试图像之一 plt.figure()#创建图形 blurred_face = ndimage.gaussian_filter(face, sigma=7)#高斯滤波 plt.imshow(blurred_face) plt.show()
2 运行结果
三 边缘锐化处理
1 代码
from scipy import misc from scipy import ndimage import matplotlib.pyplot as plt face = misc.face()#face是测试图像之一 plt.figure()#创建图形 blurred_face1 = ndimage.gaussian_filter(face, sigma=1)#边缘锐化 blurred_face3 = ndimage.gaussian_filter(face, sigma=3) sharp_face = blurred_face3 +6*(blurred_face3-blurred_face1) plt.imshow(sharp_face) plt.show()
2 运行结果
四 中值滤波
1 代码
from scipy import misc from scipy import ndimage import matplotlib.pyplot as plt face = misc.face()#face是测试图像之一 plt.figure()#创建图形 median_face = ndimage.median_filter(face,7)#中值滤波 plt.imshow(median_face) plt.show()
2 运行结果
相关文章
- Golang ProtoBuf的基本语法详解 10-20
- Python识别MySQL中的冗余索引解析 10-20
- Python+Pygame绘制小球代码展示 10-18
- Python中的数据精度问题介绍 10-18
- Python随机值生成的常用方法介绍 10-18
- python3解压缩.gz文件分析 09-27