卷积算子—掩模
Smooth/Blur给图像预处理时降低噪声。
卷积是从左向右,从上向下移动。
是这个卷积算子边缘的值乘以大图的像素,然后相加,放在最中央。
边缘像素如何处理?
向外扩张
均值滤波
高斯滤波 他们都是线性滤波
均值模糊:
blur(Mat src,Mat dst,Size(x,y),Point(-1,-1));
#include<opencv2/opencv.hpp>
#include<iostream>
using namespace cv;
using namespace std;
int main(int argc, char** argv) {
Mat src,dst;
src = imread("d:/940.jpg");
if (src.empty()) {
cout << "not load..." << endl;
return -1;
}
char input_title[] = "input";
namedWindow(input_title, WINDOW_AUTOSIZE);
namedWindow("output", WINDOW_AUTOSIZE);
imshow(input_title, src);
blur(src, dst, Size(3, 3), Point(-1, -1));//x方向模糊
imshow("output", dst);
GaussianBlur(src, dst, Size(3, 3), 11, 11);
imshow("output2", dst);
waitKey(0);
return 0;
}