opencv 的几种典型滤波操作

#include
#include
using namespace std;
using namespace cv;

int main(int argc, char**argv)

{

Mat src;
src = imread("lena.jpg");
if (src.empty()){
cout << "没有找到图像" << endl;
return 0;
}
namedWindow("", CV_WINDOW_NORMAL);
imshow("", src);

Mat dst;

//blur(src, dst, Size(10,10), Point(-1, -1));   //均值模糊

//GaussianBlur(src, dst, Size(11, 11), 10, 10);  //高斯模糊

bilateralFilter(src, dst, 15, 100, 5); //双边滤波

//medianBlur(src, dst,7);  //中值滤波
Mat dst2;
Mat kernel = (Mat_(3, 3) << 0, -1, 0, -1, 5, -1, 0, -1, 0);
filter2D(dst, dst2,-1, kernel,Point(-1,-1),0);
namedWindow("模糊图", CV_WINDOW_NORMAL);
imshow("模糊图", dst2);
waitKey(0);
return 0;
}

你可能感兴趣的:(opencv)