图像降噪,滤波处理

一、滤波
1.1 blur 均值滤波
  • def blur(src, ksize, dst=None, anchor=None, borderType=None):
    src:输入图像,ksize:均值滤波,取值范围

  • cv2.blur 使用均值滤波,即当对一个值进行滤波时,使用当前值与周围值之和,取平均做为当前值
  • blured = cv2.blur(frame,(4,4)) #进行滤波去掉噪声,(4,4)为16个像素,除去自身剩15个点平均值为当前点值

1.2 boxfilter 方框滤波
  • def boxFilter(src, ddepth, ksize, dst=None, anchor=None, normalize=None, borderType=None):
    src:输入图像,ddepth:the output image depth (-1 to use src.depth()) 输入图像深度

  • cv2.boxfilter(img, -1, (3, 3), normalize=True) 表示进行方框滤波,任意长方形
    参数说明当normalize=True时,与均值滤波结果相同, normalize=False,表示对加和后的结果不进行平均操作,大于255的使用255表示

1.3 medianBlur 中值滤波
  • def medianBlur(src, ksize, dst=None): # real signature unknown; restored from doc
    src:原图像

  • cv2.medianBlur(img, 3) #中值滤波,相当于将9个值进行排序,取中值作为当前值
    3表示当前滤波取值的方框尺寸,(固定正方形)

1.4 Guassianblur 高斯滤波
  • cv2.Guassianblur(img, (3, 3), 1) 表示进行高斯滤波,
    参数说明: 1表示σ, x表示与当前值得距离,计算出的G(x)表示权重值

猜你喜欢

转载自www.cnblogs.com/shiqi17/p/12170146.html