Opencv + Qt(VS编译器MSVC版本)的使用

这里使用的MSVC版本的QT,这个版本的好处是可以用vs编译器。
**

步骤:

**
1、opencv2.4.9 由于原来编译过VS用的源代码,现在直接把里面的bin、include、lib拿出来即可:
Opencv + Qt(VS编译器MSVC版本)的使用_第1张图片
注意dll把debug和release版本的都拿出来

2、在.pro文件中添加路径:

INCLUDEPATH+=D:\opencv\QtOpencv\include\opencv\
D:\opencv\QtOpencv\include\opencv2\
D:\opencv\QtOpencv\include

CONFIG(debug,debug|release){
LIBS+=D:\opencv\QtOpencv\lib\opencv_calib3d249d.lib\
D:\opencv\QtOpencv\lib\opencv_contrib249d.lib\
D:\opencv\QtOpencv\lib\opencv_core249d.lib\
D:\opencv\QtOpencv\lib\opencv_features2d249d.lib\
D:\opencv\QtOpencv\lib\opencv_flann249d.lib\
D:\opencv\QtOpencv\lib\opencv_gpu249d.lib\
D:\opencv\QtOpencv\lib\opencv_highgui249d.lib\
D:\opencv\QtOpencv\lib\opencv_imgproc249d.lib\
D:\opencv\QtOpencv\lib\opencv_legacy249d.lib\
D:\opencv\QtOpencv\lib\opencv_ml249d.lib\
D:\opencv\QtOpencv\lib\opencv_nonfree249d.lib\
D:\opencv\QtOpencv\lib\opencv_objdetect249d.lib\
D:\opencv\QtOpencv\lib\opencv_photo249d.lib\
D:\opencv\QtOpencv\lib\opencv_stitching249d.lib\
D:\opencv\QtOpencv\lib\opencv_video249d.lib\
D:\opencv\QtOpencv\lib\opencv_videostab249d.lib
}else{
LIBS+=D:\opencv\QtOpencv\lib\opencv_calib3d249.lib\
D:\opencv\QtOpencv\lib\opencv_contrib249.lib\
D:\opencv\QtOpencv\lib\opencv_core249.lib\
D:\opencv\QtOpencv\lib\opencv_features2d249.lib\
D:\opencv\QtOpencv\lib\opencv_flann249.lib\
D:\opencv\QtOpencv\lib\opencv_gpu249.lib\
D:\opencv\QtOpencv\lib\opencv_highgui249.lib\
D:\opencv\QtOpencv\lib\opencv_imgproc249.lib\
D:\opencv\QtOpencv\lib\opencv_legacy249.lib\
D:\opencv\QtOpencv\lib\opencv_ml249.lib\
D:\opencv\QtOpencv\lib\opencv_nonfree249.lib\
D:\opencv\QtOpencv\lib\opencv_objdetect249.lib\
D:\opencv\QtOpencv\lib\opencv_photo249.lib\
D:\opencv\QtOpencv\lib\opencv_stitching249.lib\
D:\opencv\QtOpencv\lib\opencv_video249.lib\
D:\opencv\QtOpencv\lib\opencv_videostab249.lib
}

这样加上了是将opencv静态编译了,所以后面使用exe的时候不用添加opencv的dll,但是需要添加QT的dll和VS编译器的dll,一共有下面这些,可以使用:procexp_16.05.1446001339.exe在运行的时候看差什么dll,而且还能定位

Opencv + Qt(VS编译器MSVC版本)的使用_第2张图片

其中qwindows这个QT的dll在E:\Qt\Qt5.6.0\5.6\msvc2013_64\plugins\platforms,而不是bin里面

最后成功:
Opencv + Qt(VS编译器MSVC版本)的使用_第3张图片

你可能感兴趣的:(Opencv + Qt(VS编译器MSVC版本)的使用)