计算机视觉 非线性平滑滤波算法
计算机视觉非线性平滑滤波算法(中值滤波),显示图3-9# -*- coding: utf-8 -*-# @Time: 2021/4/15 14:58# @Author: weiwei# @File: 3.9.pyfrom scipy import ndimagefrom skimage import data, utilfrom matplotlib import pyplot as pltimg
·
计算机视觉
非线性平滑滤波算法(中值滤波),显示图3-9
# -*- coding: utf-8 -*-
# @Time : 2021/4/15 14:58
# @Author : weiwei
# @File : 3.9.py
from scipy import ndimage
from skimage import data, util
from matplotlib import pyplot as plt
img = data.astronaut()[:, :, 0]
noise_img = util.random_noise(img, mode='s&p', seed=None, clip=True)
n = 3
new_img = ndimage.median_filter(noise_img, (n, n))
plt.figure()
plt.subplot(1, 3, 1)
plt.imshow(img, cmap='gray')
plt.subplot(1, 3, 2)
plt.imshow(noise_img, cmap='gray')
plt.subplot(1, 3, 3)
plt.imshow(new_img, cmap='gray')
plt.show()
更多推荐
已为社区贡献4条内容
所有评论(0)