在opencv的图像平滑处理,有高斯滤波,中值滤波,均值滤波的处理方法
import cv2标签:img,cv2,平滑,imshow,滤波,笔记,cat,opencv,blur From: https://www.cnblogs.com/kun-sir/p/16735588.html
import numpy as ap
import matplotlib.pyplot as plt
img=cv2.imread('cat.jpeg')
cv2.imshow('cat',img)
cv2.waitKey()
cv2.destroyAllWindows()
#均值滤波
# blur_cat=cv2.blur(img,(3,3)) #确定3*3的范围
#
#
# cv2.imshow('cat_blur',blur_cat)
# cv2.waitKey()
# cv2.destroyAllWindows()
#高斯滤波
# 高斯模糊的卷积核里的数值是满足高斯分布的,相当于更重视中间部分
assison=cv2.GaussianBlur(img,(5,5),1)
#
cv2.imshow('cat_assison',assison)
cv2.waitKey()
cv2.destroyAllWindows()
#中值滤波
# 相当于中值替换
# median=cv2.medianBlur(img,5)
# cv2.imshow('cat_median',median)
# cv2.waitKey()
# cv2.destroyAllWindows()