到3.0,opencv模組化了,很多運算元並不打包在一起,所以不管是用msvc也好還是mingw都需要再合併編譯.
那就乾脆用qt,真香.
qt官方文章
這是我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記憶體
cmake編譯opencv專案
其他方法與優缺點 example.cpp include include using namespace cv using namespace std intmain int argc,char ar imshow demo src waitkey 0 return0 在專案檔案中新建cmakeli...
使用GCC和CMake編譯OpenCV
注意 此教程認為你已經成功的在你的工作平台上安裝了opencv。來看乙個簡單的程式例如displayimage.cpp如下 include include using namespace cv int main int argc,char argv mat image image imread ar...
cmake編譯opencv時指定cuda版本
之前有提問說,基於cmake編譯時如果切換cuda版本,比如我同時裝了cuda8和cuda9,opencv總是找到cuda9,我想用cuda8怎麼辦?實際上,手頭上要配置的工程是基於opencv3.1.0的,這個版本沒有對cuda9.0的支援,與其去改opencv的cmake指令碼原始碼,不如切換一...