标签:uil using files names space path undle mat ogr
pro文件
QT += core
QT -= gui
TARGET = untitled111CONFIG += consoleCONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += C:\Program Files (x86)\opencv\build\include\
C:\Program Files (x86)\opencv\build\include\opencv\
C:\Program Files (x86)\opencv\build\include\opencv2
源文件
#include <opencv2/opencv.hpp> //显示找不到文件
using namespace cv;
int main()
{
Mat img = imread("D:\untitled\2.jpg");
if(img.empty())
{ fprintf(stderr,"Error: load image failed."); return -1; }
namedWindow("image", CV_WINDOW_AUTOSIZE);
imshow("image", img);
waitKey();
return 0;
}
原因:Windows的路径都要用双引号包起来,有空格的路径里,空格会截断路径,会将空格前后拆分为两个路径,涉及有空格的路径要用双引号包装。
标签:uil using files names space path undle mat ogr
原文地址:https://www.cnblogs.com/zxl971213/p/13291420.html