安装opencv
OpenCV中文网站
自己找到相应的opencv下载,
我这里下载的是2.4.8版本,双击选择目录即可进行解压,建议使用无中文和空格的目录,以防出现未知错误。
在windows下的环境变量配置
在计算机/属性/高级系统设置/高级/环境变量的系统变量中找到path并编辑。在最后添加
D:\Opencv\opencv\build\x64\vc10\bin(根据自己的的安装目录进行相应的修改)
qt工程中的配置
在所需的qt工程中双击.pro文件,
在这里面添加
INCLUDEPATH+=d:/Opencv/opencv/build/include/opencv \
d:/Opencv/opencv/build/include/opencv2 \
d:/Opencv/opencv/build/include
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_ml248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_calib3d248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_contrib248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_core248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_features2d248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_flann248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_gpu248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_highgui248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_imgproc248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_legacy248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_objdetect248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_ts248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_video248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_nonfree248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_ocl248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_photo248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_stitching248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_superres248d.lib
LIBS+=D:\Opencv\opencv\build\x86\vc10\lib\opencv_videostab248d.lib
注意,以上内容需要根据自己的安装目录和版本进行修改,这里我装的是2.4.8版本,所以后面的版本号都是2.4.8,找到自己相应目录下的文件进行核对和修改,配置就好了,随便建个qt工程实践下即可。