这是代码
#include<opencv2\highgui.hpp>
#include<opencv2/imgproc.hpp>
#include<iostream>
using namespace cv;
using namespace std;
void main() {
string path = "D:Resources/test.png";
Mat img = imread(path);
imshow("Image", img);
waitKey(0);
}
图片路径不对哈
window下的c++代码,路径要用两个斜杠\。
string path = "D:Resources/test.png";
改为
string path = "D:\\Resources\\test.png";
谢谢!这个确实是问题 可是改完之后还是会出现一堆奇怪的东西QAQ
已经解决了!在最开头添加了#include<opencv2/imgcodecs.hpp>