到3.0,opencv模块化了,很多算子并不打包在一起,所以不管是用msvc也好还是mingw都需要再合并编译.
那就干脆用qt,真香.
qt官方文章https://wiki.qt.io/How_to_setup_Qt_and_openCV_on_Windows
编译出现的问题及解决办法上面都有,再比较细节的地方说明就去 我的资源 下载吧,一起还有opencv3.4.3和contrib3.4.3的编译ok的包,因为比较大我分两个压缩的.
https://download.csdn.net/download/qq_38238171/12076252
https://download.csdn.net/download/qq_38238171/12076246
这是我project的.pro文件添加的头文件和lib,
INCLUDEPATH += D:\opencv\CompiledOpencv3.4.3WithContribForQt\include\ D:\opencv\CompiledOpencv3.4.3WithContribForQt\include\opencv\ D:\opencv\CompiledOpencv3.4.3WithContribForQt\include\opencv2
LIBS += D:\opencv\CompiledOpencv3.4.3WithContribForQt\lib\libopencv_calib3d343.dll.a\
D:\opencv\CompiledOpencv3.4.3WithContribForQt\lib\libopencv_core343.dll.a\
D:\opencv\CompiledOpencv3.4.3WithContribForQt\lib\libopencv_features2d343.dll.a\D:\opencv\CompiledOpencv3.4.3WithContribForQt\lib\libopencv_highgui343.dll.a\D:\opencv\CompiledOpencv3.4.3WithContribForQt\lib\libopencv_imgproc343.dll.a\D:\opencv\CompiledOpencv3.4.3WithContribForQt\lib\libopencv_imgcodecs343.dll.a\D:\opencv\CompiledOpencv3.4.3WithContribForQt\lib\libopencv_video343.dll.a\D:\opencv\CompiledOpencv3.4.3WithContribForQt\lib\libopencv_videoio343.dll.a\D:\opencv\CompiledOpencv3.4.3WithContribForQt\lib\libopencv_videostab343.dll.a\D:\opencv\CompiledOpencv3.4.3WithContribForQt\lib\libopencv_face343.dll.a
当然咯,像官文那样直接lib+=******************dll应该也是可以的.
编译完成使用时使用发现一个BUG,
在capture.read()前后必须要namedWindow或者imgshow一下,不然直接卡死.
在不编译前直接用msvc是没得这个问题的,应该是编译时哪里变量没初始化或者线程啥的吧.懒得去弄了,因为多挂个废窗口隐藏起来也就多个0.5m内存