1.准备:
库:opencv,numpy
编译环境:PyCharm(当然,其他集成编译环境也可以)
2.正文:
import cv2
import numpy as np
img01 = cv2.imread("E:\cpy\photo\image01.bmp")#读取目标图片
#中值滤波
img_medianBlur=cv2.medianBlur(img01,5)
font=cv2.FONT_HERSHEY_SIMPLEX
#均值滤波
img_Blur=cv2.blur(img01,(5,5))
#高斯滤波
img_GaussianBlur=cv2.GaussianBlur(img01,(7,7),0)
#高斯双边滤波
img_bilateralFilter=cv2.bilateralFilter(img01,40,75,75)
中值滤波
其实中值滤波,就相当于模板中取中间那个数,比较好过滤椒盐噪声。既然是取中间的那个值,那么图像就必然会变得模糊。
均值滤波
高斯滤波
高斯双边滤波
另有参考
https://www.cnblogs.com/hanxiaosheng/p/9566320.html
https://www.cnblogs.com/FHC1994/p/9097231.html
https://blog.csdn.net/zhangfuliang123/article/details/74892351
https://blog.csdn.net/weixin_42026802/article/details/80181627
https://blog.csdn.net/qq_27261889/article/details/80822270(总结)
https://blog.csdn.net/weixin_37720172/article/details/72843238(自己实现)