c++中值滤波和双边滤波
程序员文章站
2022-07-14 16:16:25
...
#include<iostream>
#include<opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int main()
{
Mat example = imread("D:\\VC项目\\img4.jpg");
Mat out_ex1,out_ex2,out_ex3;
if (!example.data)
{
cout << "图片路径错误!!!" << endl;
}
medianBlur(example,out_ex1, 3);//中值滤波的Api
GaussianBlur(out_ex1, out_ex3, Size(3, 3), 1.0, 1.0, 4);//高斯滤波的Api
bilateralFilter(out_ex1, out_ex2,15,10,3);//高斯双边滤波的Api
imshow("example", example);
imshow("median_ex1", out_ex1);
imshow("b_F_ex2", out_ex2);
imshow("Gussian_ex3", out_ex3);
waitKey(0);
return 0;
}