由于编译器找不到“Size”类型的定义,需要在代码中添加头文件“#include
#include
using namespace cv; using namespace std;
int main() { Mat frame = imread("test.jpg"); // 读取图像
if (frame.empty()) // 若读取失败,则返回
{
cout << "读取图像失败!" << endl;
return -1;
}
GaussianBlur(frame, frame, Size(10, 10), 1.0); // 高斯滤波
imshow("滤波后的图像", frame); // 显示滤波后的图像
waitKey(0);
return 0;
}