Linear filter
Normalized Box Filter/最简单的滤波器
- blur(src, dst, Size(w,h), Point(-1,-1));
- src: Source image
- dst: Destination image
- Size(w, h): Defines the size of the kernel to be used
- Point(-1, -1): Indicates where the anchor point(the pixel evaluated)
is located with respect to the neighborhood.
Gaussian Fliter/最实用但并不是最快的的滤波器
- GaussianBlur(src, dst, Size(i,i), 0,0);
- 最后两个参数代表是往x方向求导还是y方向,两个都为0,则代表使用kernel size
Median Filter 中值滤波器
- 遍历每个像素并用周围像素的中值代替该像素
- medianBlur(src, dst, i);
- i: Size of the kernel(only one because we use a square window, and it must be odd)
Bilateral Filter/为了避免滤波器不仅消除了噪声,且将边缘也消融了。
- bilateralFilter(src, dst, i, i*2, i/2);
- i: the diameter of each pixel neighborhood
- i*2: Standard deviation in the color space
- i/2: Standard deviation in the coordinate space.
- bilateralFilter(src, dst, i, i*2, i/2);