您的位置:首页 > 运维架构

opencv3.0 函数学习5——medianBlur 中值滤波

2016-08-08 14:56 495 查看
3.medianBlur 中值滤波

中值滤波是基于排序统计理论的一种能有效抑制噪声的非线性信号处理技术,对脉冲噪声有良好的滤除作用,特别是在滤除噪声的同时,能够保护信号的边缘,使之不被模糊。这些优良特性是线性滤波方法所不具有的。此外,中值滤波的算法比较简单,也易于用硬件实现。

中值滤波就是将当前像素值替换为模板覆盖范围内的所有像素值中大小居中那一个:对于一个3*3的模板,第5大的就是中值:

(10,15,20,20,20,20,20,25,100)

中值滤波使得那些更亮(或者更暗)的点更像他周围的值。所以它在滤除噪音的同时,可以较好地保留细节轮廓。

函数说明

void cv::medianBlur(InputArray src,
  OutputArray dst,
  int ksize 
 )  
Blurs an image using the median filter.

The function smoothes an image using the median filter with the
ksize×ksize 
aperture. Each channel of a multi-channel image is processed independently. In-place operation is supported.

Parameters
srcinput 1-, 3-, or 4-channel image; when ksize is 3 or 5, the image depth should be CV_8U, CV_16U, or CV_32F, for larger aperture sizes, it can only be CV_8U.
dstdestination array of the same size and type as src.
ksizeaperture linear size; it must be odd and greater than 1, for example: 3, 5, 7 ...
See alsobilateralFilter,

blur,
boxFilter,
GaussianBlur Examples: houghcircles.cpp, and

laplace.cpp.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息