1.首先下载opencv源码
2.qt 新建一个工程,随便哪个
3.打开.pro文件
4.添加路径
这里要注意,坑了一波
opencv的源码路径不能有空格,不然识别不了,比如program file这种就不行
所以自己存的时候注意一点
添加INCLUDEPATH
INCLUDEPATH += C:\Software\opencv\build\include\opencv2\
INCLUDEPATH += C:\Software\opencv\build\include\opencv\
INCLUDEPATH += C:\Software\opencv\build\include\
#这里的具体路径根据自己opencv存放的位置修改
添加LIB
LIBS+=C:\Software\opencv\build\x64\vc12\lib\opencv_ml249d.lib
LIBS+=C:\Software\opencv\build\x64\vc12\lib\opencv_calib3d249d.lib
LIBS+=C:\Software\opencv\build\x64\vc12\lib\opencv_contrib249d.lib
LIBS+=C:\Software\opencv\build\x64\vc12\lib\opencv_core249d.lib
LIBS+=C:\Software\opencv\build\x64\vc12\lib\opencv_features2d249