一 原始图像 

1 代码
  1. from scipy import misc
  2. from scipy import ndimage
  3. import matplotlib.pyplot as plt
  4. face = misc.face()#face是测试图像之一
  5. plt.figure()#创建图形
  6. plt.imshow(face)#绘制测试图像
  7. plt.show()#原始图像
2 运行结果

图像处理模块ndimage
 
 
二 高斯滤波
1 代码
  1. from scipy import misc
  2. from scipy import ndimage
  3. import matplotlib.pyplot as plt
  4. face = misc.face()#face是测试图像之一
  5. plt.figure()#创建图形
  6. blurred_face = ndimage.gaussian_filter(face, sigma=7)#高斯滤波
  7. plt.imshow(blurred_face)
  8. plt.show()
2 运行结果

图像处理模块ndimage
 
 
三 边缘锐化处理
1代码
  1. from scipy import misc
  2. from scipy import ndimage
  3. import matplotlib.pyplot as plt
  4. face = misc.face()#face是测试图像之一
  5. plt.figure()#创建图形
  6. blurred_face1 = ndimage.gaussian_filter(face, sigma=1)#边缘锐化
  7. blurred_face3 = ndimage.gaussian_filter(face, sigma=3)
  8. sharp_face = blurred_face3 +6*(blurred_face3-blurred_face1)
  9. plt.imshow(sharp_face)
  10. plt.show()
2运行结果

图像处理模块ndimage
 
 
四 中值滤波 
1 代码
  1. from scipy import misc
  2. from scipy import ndimage
  3. import matplotlib.pyplot as plt
  4. face = misc.face()#face是测试图像之一
  5. plt.figure()#创建图形
  6. median_face = ndimage.median_filter(face,7)#中值滤波
  7. plt.imshow(median_face)
  8. plt.show()
2 运行结果

图像处理模块ndimage
 

相关文章:

  • 2021-04-13
  • 2022-02-08
  • 2022-02-16
  • 2022-12-23
  • 2022-12-23
  • 2021-04-18
  • 2021-11-23
  • 2022-12-23
猜你喜欢
  • 2021-08-28
  • 2021-06-10
  • 2022-12-23
  • 2021-11-25
  • 2022-02-23
  • 2022-12-23
  • 2021-10-16
相关资源
相似解决方案