- 软件准备
-
OpenCV
-
cmake
-
MinGW-W64
MinGW-W64要下载
否则后面编译出错:D:/openCV_win/opencv/sources/modules/core/include/opencv2/core/utility.hpp:719:29: error: 'Mutex' is not a member of 'cv' typedef std::lock_guard<cv::Mutex> AutoLock; ^~~~~ D:/openCV_win/opencv/sources/modules/core/include/opencv2/core/utility.hpp:719:29: note: suggested alternative: 'Matx' typedef std::lock_guard<cv::Mutex> AutoLock; ^~~~~ Matx D:/openCV_win/opencv/sources/modules/core/include/opencv2/core/utility.hpp:719:29: error: 'Mutex' is not a member of 'cv' D:/openCV_win/opencv/sources/modules/core/include/opencv2/core/utility.hpp:719:29: note: suggested alternative: 'Matx' typedef std::lock_guard<cv::Mutex> AutoLock; ^~~~~ Matx D:/openCV_win/opencv/sources/modules/core/include/opencv2/core/utility.hpp:719:34: error: template argument 1 is invalid typedef std::lock_guard<cv::Mutex> AutoLock; ^ [ 14%] Building CXX object CMakeFiles/ade.dir/3rdparty/ade/ade-0.1.1f/sources/ade/source/graph.cpp.obj minGW32-make[2]: *** [modules\core\CMakeFiles\opencv_core.dir\build.make:118: modules/core/CMakeFiles/opencv_core.dir/src/alloc.cpp.obj] Error 1 [ 14%] Building C object 3rdparty/libpng/CMakeFiles/libpng.dir/pngget.c.obj [ 14%] Building C object 3rdparty/libtiff/CMakeFiles/libtiff.dir/tif_codec.c.obj In file included from D:\openCV_win\opencv\sources\modules\core\src\arithm.cpp:50: D:\openCV_win\opencv\sources\modules\core\src\precomp.hpp:369:5: error: 'Mutex' in namespace 'cv' does not name a type cv::Mutex& getInitializationMutex(); ^~~~~ D:\openCV_win\opencv\sources\modules\core\src\precomp.hpp:369:1: note: suggested alternative: 'Matx' cv::Mutex& getInitializationMutex(); ^~ Matx
-
- 配置环境变量
- 打开Cmake下的bin目录下的cmake-gui.exe
第一行选择OpenCV sources目录,第三行选择编译输出路径,然后点击configure按下图配置
- finish后开始生成Makefiles文件配置,然后点击configure,完成后点击genrate
- done后,进入输出目录执行minGW32-make -j8
- 执行minGW32-make install
- 编译后的opencv添加到环境变量