Qt 中支持Opencv

Qt中支持Opencv 库,

1.安装qt程序 包含 mingw

2.安装cmake

3.下载opencv源码:

源码下载地址:https://github.com/opencv/opencv

用cmake编译 opencv库

Qt 中支持Opencv_第1张图片

source code  选择 opencv 源码

build 处选择你编译存取路径

点击configure  选择 mingw

点击 Genarate

然后打开cmd控制台 进入build目录 :

依次键入 mingw32-make 和 mingw32-make install ,

进行编译和安装 ,

执行完后 在 build  install 目录下有 你要的库和头文件

然后将其加入 QT 的pro文件中

 

INCLUDEPATH += $$PWD/../opencv/include/
 
LIBS += $$PWD/../opencv/lib/libopencv_calib3d412.dll.a
LIBS += $$PWD/../opencv/lib/libopencv_core412.dll.a
LIBS += $$PWD/../opencv/lib/libopencv_dnn412.dll.a
LIBS += $$PWD/../opencv/lib/libopencv_features2d412.dll.a
LIBS += $$PWD/../opencv/lib/libopencv_flann412.dll.a
LIBS += $$PWD/../opencv/lib/libopencv_gapi412.dll.a
LIBS += $$PWD/../opencv/lib/libopencv_highgui412.dll.a
LIBS += $$PWD/../opencv/lib/libopencv_imgcodecs412.dll.a
LIBS += $$PWD/../opencv/lib/libopencv_imgproc412.dll.a
LIBS += $$PWD/../opencv/lib/libopencv_ml412.dll.a
LIBS += $$PWD/../opencv/lib/libopencv_objdetect412.dll.a
LIBS += $$PWD/../opencv/lib/libopencv_photo412.dll.a
LIBS += $$PWD/../opencv/lib/libopencv_stitching412.dll.a
LIBS += $$PWD/../opencv/lib/libopencv_video412.dll.a
LIBS += $$PWD/../opencv/lib/libopencv_videoio412.dll.a
LIBS += $$PWD/../opencv/lib/libopencv_stitching412.dll.a
 
完成后 然后可以编译使用了

你可能感兴趣的:(QT)