欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

qt5.4.0 + opencv2.4.10

程序员文章站 2024-01-12 16:50:58
...

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环境变量

选择“我的电脑”,右键选择“属性”,

qt5.4.0 + opencv2.4.10

在弹出的对话框中选择“高级系统设置”,

qt5.4.0 + opencv2.4.10

然后在弹出的对话框中选择“高级”->环境变量

qt5.4.0 + opencv2.4.10

在变量值中添加opencv的路径

1)D:\opencv\build\include

2)D:\opencv\build\include\opencv

3)D:\opencv\build\include\opencv2

每个路径之间用分号隔开;

qt5.4.0 + opencv2.4.10


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
qt5.4.0 + opencv2.4.10

添加之后,选中新建项目opencvTest右键,选中“执行qmake”;

然后在main.cpp里面输入测试代码

#include
#include
#include
#include
usingnamespacestd;
usingnamespacecv;

intmain(intargc,char*argv[])
{
//QCoreApplicationa(argc,argv);
//returna.exec();
cout"opencv"