均值滤波
即 对该点附近的 一般为3×3或者5×5矩阵求和,然后取求均值放回该点
例如
12 23 67 34 222 52 16 79
52 25 97 94 202 42 96 39
82 64 227 84 22 20 126 59
42 27 123 54 212 232 156 249
22 23 97 94 42 132 186 179
...........
均值处理:
以227值的点为例子:
对227值的点附近3×3矩阵的点求和-->除以9,即求均值
ave=(15+97+94+64+227+84+27+123+54)/9
=785/9
=87.22
均值为87.22
将该值87放回原来227值的点的位置
其他各点用同样的方法求均值
◆ blur()
void cv::blur ( InputArray src,
OutputArray dst,
Size ksize,
Point anchor = Point(-1,-1),
int borderType = BORDER_DEFAULT
)
Python:
dst = cv.blur( src, ksize[, dst[, anchor[, borderType]]] )
#include <opencv2/imgproc.hpp>
Blurs an image using the normalized box filter.
The function smooths an image using the kernel:
The call blur(src, dst, ksize, anchor, borderType) is equivalent to boxFilter(src, dst, src.type(), ksize, anchor, true, borderType).
Parameters
src input image; it can have any number of channels, which are processed independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
dst output image of the same size and type as src.
ksize blurring kernel size.
anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel center.
borderType border mode used to extrapolate pixels outside of the image, see BorderTypes. BORDER_WRAP is not supported.
See also
boxFilter, bilateralFilter, GaussianBlur, medianBlur
Examples:
samples/cpp/edge.cpp, samples/cpp/laplace.cpp, and samples/cpp/tutorial_code/ImgProc/Smoothing/Smoothing.cpp.
参考链接:
https://docs.opencv.org/master/d4/d86/group__imgproc__filter.html#ga8c45db9afe636703801b0b2e440fce37