> 文档中心 > 均值滤波、高斯滤波、高斯双边滤波

均值滤波、高斯滤波、高斯双边滤波

# -*-coding:utf-8-*-# #TODO.1.均值滤波import cv2def image_blur(image_path1:str):    img1=cv2.imread(image_path1,cv2.IMREAD_COLOR)    img1=cv2.resize(img1,(300,300))    cv2.imshow('img1',img1)    result1=cv2.blur(img1,(5,5))    cv2.imshow('result1',result1)#TODO.2.高斯滤波def image_conv(image_path2:str):    img2=cv2.imread(image_path2,cv2.IMREAD_COLOR)    img2 = cv2.resize(img2, (300, 300))    cv2.imshow('img2',img2)    result2=cv2.GaussianBlur(img2,(0,0),15)    cv2.imshow('result2',result2)# TODO.3.高斯双边滤波(照片变清楚了)def image_bifilter(image_path3:str):    img3=cv2.imread(image_path3,cv2.IMREAD_COLOR)    img3 = cv2.resize(img3, (300, 300))    cv2.imshow('img3',img3)    result3=cv2.bilateralFilter(img3,0,50,10)    cv2.imshow('result3',result3)if __name__=='__main__':    path='211.jpg'    image_blur(path)    image_conv(path)    image_bifilter(path)    cv2.waitKey(0)    cv2.destroyAllWindows()

 

 

 照片来源于网络,侵权请联系删除