PC:win7(X64) Qt:qt-opensource-windows-x86-msvc2013_64-5.4.0 opencv:opencv-2.4.10 1、将qt正确安装到D盘,将opencv解压到D盘; 2、配置opencv环境变量 选择“我的电脑”,右键选择“属性”, 在弹出的对话框中选择“高级系统设置”, 然后在弹出的对话框
PC:win7(X64)
Qt:qt-opensource-windows-x86-msvc2013_64-5.4.0
opencv:opencv-2.4.10
1、将qt正确安装到D盘,将opencv解压到D盘;
2、配置opencv环境变量
选择“我的电脑”,右键选择“属性”,
在弹出的对话框中选择“高级系统设置”,
然后在弹出的对话框中选择“高级”->环境变量
在变量值中添加opencv的路径
1)D:\opencv\build\include
2)D:\opencv\build\include\opencv
3)D:\opencv\build\include\opencv2
每个路径之间用分号隔开;
3、新建一个Qt项目,例opencvTest
在opencvTest.pro里面添加包含路径和库
INCLUDEPATH+=D:\opencv\build\include\
D:\opencv\build\include\opencv\
D:\opencv\build\include\opencv2
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_ml2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_calib3d2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_contrib2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_core2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_features2d2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_flann2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_gpu2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_highgui2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_imgproc2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_legacy2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_objdetect2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_ts2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_video2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_nonfree2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_ocl2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_photo2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_stitching2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_superres2410d.lib
LIBS+=D:\opencv\build\x64\vc12\lib\opencv_videostab2410d.lib
添加之后,选中新建项目opencvTest右键,选中“执行qmake”;
然后在main.cpp里面输入测试代码
#include
#include
#include
#include
usingnamespacestd;
usingnamespacecv;
intmain(intargc,char*argv[])
{
//QCoreApplicationa(argc,argv);
//returna.exec();
cout<<"opencv"<
Matsrc=imread("C:/Users/user/Desktop/tt.jpg");//绝对路径
imshow("test",src);
waitKey(0);
return0;
}
配置成功!
声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。TEL:177 7030 7066 E-MAIL:11247931@qq.com