ImgProc/Smoothing.cpp 与 photo/non_photorealistic_rendering.cpp 中算法对比:
滤波器小结
一、低通滤波器(模糊和平滑)
1、均值(线性)
2、高斯(线性) 去白噪声
3、中值(非线性) 去椒盐噪声
二、高通滤波器(可边缘检测)
1、sobel算子(方向)
2、拉普拉斯变换(二阶导数)
三、邻域滤波
1、方框
2、高斯
3、中值
4、双边(非线性) 保边去噪
原图
Smoothing.cpp中的
归一化滤波:blur( src, dst, Size( i, i ), Point(-1,-1) ) 线性
高斯滤波:GaussianBlur( src, dst, Size( i, i ), 0, 0 ) 线性,去白噪声
中值滤波:medianBlur ( src, dst, i ) 非线性,去椒盐噪声
双边滤波: bilateralFilter ( src, dst, i, i*2, i/2 ) 非线性,效果好,可以实现保边去噪
non_photorealistic_rendering中的:
edgePreservingFilter(src,img,type);分两种type,type=1为Normalized Convolution Filter(归一卷积滤波),type=2为Recursive Filter(回归滤波)
结果分别是:
Normalized Convolution Filter:
Recursive Filter:
detailEnhance(src,img); 细节增强
pencilSketch(src,img1, img, 10 , 0.1f, 0.03f);
stylization(src,img);