# -*- coding: utf-8 -*- #code:myhaspl@myhaspl.com #归一化块滤波 import cv2 import numpy as np fn="test3.jpg" myimg=cv2.imread(fn) img=cv2.cvtColor(myimg,cv2.COLOR_BGR2GRAY) #加上高斯噪声,可以参考以前博文中的内容 ...... ...... #滤波去噪 lbimg=cv2.blur(newimg,(3,3)) cv2.imshow(‘src‘,newimg) cv2.imshow(‘dst‘,lbimg) cv2.waitKey() cv2.destroyAllWindows()
右图是加上噪声,左图是去除噪声后,虽然进行了图像模糊,但仍能比较清晰