1、软件安装
1.1 Python安装路径:C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32 安装包:python3.8.exe
1.2 QT安装路径:C:\Qt\Qt5.13.0 安装包:opencv-4.5.0-vc14_vc15.exe
1.3 CMake安装路径:C:\Program Files\CMake 安装包:cmake-2.8.12.2-win32-x86.exe
1.4 Java安装路径:C:\Program Files\Java\jdk-18.0.1 安装包:JavaSEDevelopmentKit.exe
2、环境变量配置
C:\Program Files\CMake\bin;
C:\Qt\Qt5.13.0\5.13.0\msvc2017\bin;
C:\Qt\Qt5.13.0\5.13.0\mingw73_32\bin;
C:\Qt\Qt5.13.0\Tools\mingw730_32\bin;
C:\opencv\build\x64\vc15\bin;
C:\Qt\Qt5.13.0\5.13.0\mingw73_64\bin;
C:\Qt\Qt5.13.0\Tools\mingw730_64\bin
3、打开CMake软件进行配置
点击 Configure,设置编译器
Specify the generator for this project: MinGW Makefiles
Specify native compilers
Next
Compilers C: C:/Qt/Qt5.13.0/Tools/mingw730_64/bin/gcc.exe
Compilers C++: C:/Qt/Qt5.13.0/Tools/mingw730_64/bin/g++.exe
Finish
设置源码位置:C:/opencv/sources
设置生成项目位置:C:/opencv/build_mingw
WITH_OPENGL 勾选
WITH_QT 不勾选
OPENCV_VS_VERSIONINFO_SKIP 勾选
OPENCV_ENABLE_ALLOCATOR_STATS 不勾选
WITH_OPENCL_D3D11_NV 不勾选
其中:OPENCV_VS_VERSIONINFO_SKIP需要点击Add Entry按钮手工新增,OPENCV_VS_VERSIONINFO_SKIP BOOL 1.
4、下载必要文件到指定位置
C:\opencv\build_mingw\3rdparty\ffmpeg\ffmpeg_version.cmake
C:\opencv\build_mingw\3rdparty\ffmpeg\opencv_videoio_ffmpeg.dll
C:\opencv\build_mingw\3rdparty\ffmpeg\opencv_videoio_ffmpeg_64.dll
5、编译项目文件:
在CMake软件界面点击两次Configure后再点击Generate后,可以cmd窗口中跳转到到指定目录,执行下面命令:
C:\opencv\build_mingw>mingw32-make -j 8
C:\opencv\build_mingw>mingw32-make install