使用cmake編譯
編譯資料夾在opencv安裝資料夾下,名字是release
d:\opencv\sources\3rdparty\protobuf\src\google\protobuf\stubs\io_win32.cc:94:3: warning: identifier 'nullptr' is a keyword in c++11 [-wc++0x-compat]
return s == nullptr || *s == 0;
^d:\opencv\sources\3rdparty\protobuf\src\google\protobuf\stubs\io_win32.cc: in function 'bool google::protobuf::internal::win32::::null_or_empty(const char_type*)':
d:\opencv\sources\3rdparty\protobuf\src\google\protobuf\stubs\io_win32.cc:94:15: error: 'nullptr' was not declared in this scope
return s == nullptr || *s == 0;
^3rdparty\protobuf\cmakefiles\libprotobuf.dir\build.make:412: recipe for target '3rdparty/protobuf/cmakefiles/libprotobuf.dir/src/google/protobuf/stubs/io_win32.cc.obj' failed
mingw32-make[2]: *** [3rdparty/protobuf/cmakefiles/libprotobuf.dir/src/google/protobuf/stubs/io_win32.cc.obj] error 1
cmakefiles\makefile2:710: recipe for target '3rdparty/protobuf/cmakefiles/libprotobuf.dir/all' failed
mingw32-make[1]: *** [3rdparty/protobuf/cmakefiles/libprotobuf.dir/all] error 2
makefile:161: recipe for target 'all' failed
mingw32-make: *** [all] error 2
在 cmake-gui 編譯配置中:
勾選enable_cxx11
然後重新configure
-generate
-mingw32-make
makefile:161: recipe for target 'all' failed
mingw32-make: *** [all] error 2
修改d:\opencv\sources\modules\videoio\src\cap_dshow.cpp
檔案,在#include "dshow.h"
這行的上面加一行#define no_dshow_strsafe
然後重新configure
-generate
-mingw32-make
d:\opencv\sources\3rdparty\protobuf\src\google\protobuf\stubs\io_win32.cc: in function 'file* google::protobuf::internal::win32::fopen(const char*, const char*)':
d:\opencv\sources\3rdparty\protobuf\src\google\protobuf\stubs\io_win32.cc:330:10: error: '::_wfopen' has not been declared
return ::_wfopen(wpath.c_str(), wmode.c_str());
^3rdparty\protobuf\cmakefiles\libprotobuf.dir\build.make:258: recipe for target '3rdparty/protobuf/cmakefiles/libprotobuf.dir/src/google/protobuf/stubs/io_win32.cc.obj' failed
mingw32-make[2]: *** [3rdparty/protobuf/cmakefiles/libprotobuf.dir/src/google/protobuf/stubs/io_win32.cc.obj] error 1
cmakefiles\makefile2:687: recipe for target '3rdparty/protobuf/cmakefiles/libprotobuf.dir/all' failed
mingw32-make[1]: *** [3rdparty/protobuf/cmakefiles/libprotobuf.dir/all] error 2
makefile:161: recipe for target 'all' failed
mingw32-make: *** [all] error 2
修改d:\opencv\release中的cmakecache.txt,查詢cmake_cxx_flags,然後把cmake_cxx_flags:string的值修改為-u__strict_ansi__,即cmake_cxx_flags:string=-u__strict_ansi__
注意一定不要重新configure
-generate
!!
做了這步操作之後cmakecache.txt又會重新生成。直接mingw32-make
********************=使用qt時pro檔案需要新增的*****************=
includepath+=d:\opencv\build\include
libs+=-l d:\opencv\release\lib\libopencv_*.a
利用opencv3 4 1進行正態貝葉斯分類
當樣本的特徵向量滿足多維正態分佈時,對於分類任務,可以使用正態貝葉斯分類方法,進行訓練。使用opencv3.4.1中的ml模組,具體實現demo如下 include pch.h include includeusing namespace std using namespace cv using n...
安裝OpenCv時出現大量紅字
今天在安裝python下的opencv時,總會出現一大片紅色字。錯誤如圖 在這裡插入描述 明明是按照步驟來的,後來發現是網速限制,需要乙個映象源就可以解決。pip install opencv python 在這個後面加上 i trusted host pypi.douban.com 就可以了 合起...
CGAL編譯時出現的問題
用cmake編譯cgal時出現的問題,有懂這個的朋友可以幫忙看一看嗎?the imported target qt5 help references the file but this file does not exist.possible reasons include the file was...