opencv4.5.5+qt5.15.2+vtk9.1+mingw81_64编译记录

目录

一 VTK编译

二 无opencv_contrib编译记录

三 有opencv_contrib编译记录

四 参考链接

mingw编译器针对很多仓库代码没有编译错误,适配mingw是个好选择。

编译结果文件:

链接:https://pan.baidu.com/s/11pgNAwn_o-saygo1blJz4A
提取码:w5so

opencv4.5.5+qt5.15.2+vtk9.1+mingw81_64编译记录

一 VTK编译

cd C:\Users\pgjgg\Desktop\CODE\VTK

mkdir build

cd build

cmake -DCMAKE_BUILD_TYPE="Release"  -G "MinGW Makefiles" -DCMAKE_PREFIX_PATH="C:/Qt/5.15.2/mingw81_64/lib/cmake/Qt5"  ../

mingw32-make -j48

mingw32-make install

中间存在编译错误,继续使用编译指令:

mingw32-make -j48

或者在cmake-gui手动取消一些build。

类似这样:

opencv4.5.5+qt5.15.2+vtk9.1+mingw81_64编译记录

opencv4.5.5+qt5.15.2+vtk9.1+mingw81_64编译记录

最后管理员运行cmd.exe后,执行:

mingw32-make install

opencv4.5.5+qt5.15.2+vtk9.1+mingw81_64编译记录

opencv4.5.5+qt5.15.2+vtk9.1+mingw81_64编译记录

二 无opencv_contrib编译记录

git clone https://gitcode.net/opencv/opencv

cd C:\Users\pgjgg\Desktop\CODE\opencv

mkdir build

cd build

cmake -DCMAKE_BUILD_TYPE="Release"  -G "MinGW Makefiles" -DQT_QMAKE_EXECUTABLE="C:/Qt/Tools/mingw810_64/bin/qmake.exe" -DQt5_DIR="C:/Qt/5.15.2/mingw81_64/lib/cmake/Qt5" -DCMAKE_PREFIX_PATH="C:/Program Files (x86)/VTK/lib/cmake/vtk-9.1"  ../

mingw32-make -j64

mingw32-make install

这样是没有适配QT的,需要手动在cmake-gui添加QT。

配置如下:

ocv_init_download: Using gitcode-hosted mirror to download 3rdparty components.

Registering hook ‘OPENCV_DOWNLOAD_PRE’: C:/Users/pgjgg/Desktop/CODE/opencv/cmake/mirrors/gitcode.cmake
Detected processor: AMD64
Found PythonInterp: C:/Users/pgjgg/AppData/Local/Programs/Python/Python39/python.exe (found suitable version “3.9.7”, minimum required is “2.7”)
AVX_512F is not supported by C++ compiler
AVX512_COMMON is not supported by C++ compiler
AVX512_SKX is not supported by C++ compiler
Dispatch optimization AVX512_SKX is not available, skipped
libjpeg-turbo: VERSION = 2.1.2, BUILD = opencv-4.5.5-dev-libjpeg-turbo
Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1). OpenJPEG will be built from sources
OpenJPEG: VERSION = 2.4.0, BUILD = opencv-4.5.5-dev-openjp2-2.4.0
OpenJPEG libraries will be built from sources: libopenjp2 (version “2.4.0”)
Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
Could NOT find BLAS (missing: BLAS_LIBRARIES)
Could NOT find LAPACK (missing: LAPACK_LIBRARIES)
Reason given by package: LAPACK could not be found because dependency BLAS could not be found.

Found VTK 9.1.20220207
Consider adding OPENCV_ALLOCATOR_STATS_COUNTER_TYPE=int/int64_t according to your build configuration
Excluding from source files list:
Excluding from source files list:
Excluding from source files list:
Registering hook ‘INIT_MODULE_SOURCES_opencv_dnn’: C:/Users/pgjgg/Desktop/CODE/opencv/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
opencv_dnn: filter out cuda4dnn source code
Excluding from source files list:
Excluding from source files list:
Excluding from source files list:
imgcodecs: OpenEXR codec is disabled in runtime. Details: https://github.com/opencv/opencv/issues/21326
highgui: using builtin backend: QT5
Found ‘misc’ Python modules from C:/Users/pgjgg/Desktop/CODE/opencv/modules/python/package/extra_modules
Found ‘mat_wrapper;utils’ Python modules from C:/Users/pgjgg/Desktop/CODE/opencv/modules/core/misc/python/package
Found ‘gapi’ Python modules from C:/Users/pgjgg/Desktop/CODE/opencv/modules/gapi/misc/python/package
Found ‘misc’ Python modules from C:/Users/pgjgg/Desktop/CODE/opencv/modules/python/package/extra_modules
Found ‘mat_wrapper;utils’ Python modules from C:/Users/pgjgg/Desktop/CODE/opencv/modules/core/misc/python/package
Found ‘gapi’ Python modules from C:/Users/pgjgg/Desktop/CODE/opencv/modules/gapi/misc/python/package
CMake Warning at cmake/OpenCVGenSetupVars.cmake:54 (message):
CONFIGURATION IS NOT SUPPORTED: validate setupvars script in install
directory
Call Stack (most recent call first):
CMakeLists.txt:1039 (include)

General configuration for OpenCV 4.5.5-dev =====================================
Version control: 4.5.5-407-g11f36bdf9a

Platform:
Timestamp: 2022-05-20T09:51:33Z
Host: Windows 10.0.18363 AMD64
CMake: 3.19.2
CMake generator: MinGW Makefiles
CMake build tool: C:/Qt/Tools/mingw810_64/bin/mingw32-make.exe
Configuration: Release

CPU/HW features:
Baseline: SSE SSE2 SSE3
requested: SSE3
Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2
requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
SSE4_1 (18 files): + SSSE3 SSE4_1
SSE4_2 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2
FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
AVX (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2 (33 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2

C/C++:
Built as dynamic libs?: YES
C++ standard: 11
C++ Compiler: C:/Qt/Tools/mingw810_64/bin/g++.exe (ver 8.1.0)
C++ flags (Release): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
C++ flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
C Compiler: C:/Qt/Tools/mingw810_64/bin/gcc.exe
C flags (Release): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
C flags (Debug): -fsigned-char -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release): -Wl,–gc-sections
Linker flags (Debug): -Wl,–gc-sections
ccache: NO
Precompiled headers: NO
Extra dependencies:
3rdparty dependencies:

OpenCV modules:
To be built: calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo python3 stitching ts video videoio
Disabled: world
Disabled by dependency: –
Unavailable: java python2
Applications: tests perf_tests apps
Documentation: NO
Non-free algorithms: NO

Windows RT support: NO

GUI: QT5
QT: YES (ver 5.15.2 )
QT OpenGL support: YES (Qt5::OpenGL 5.15.2)
Win32 UI: YES
OpenGL support: YES (opengl32 glu32)
VTK support: YES (ver 9.1.20220207)

Media I/O:
ZLib: build (ver 1.2.12)
JPEG: build-libjpeg-turbo (ver 2.1.2-62)
WEBP: build (ver encoder: 0x020f)
PNG: build (ver 1.6.37)
TIFF: build (ver 42 – 4.2.0)
JPEG 2000: build (ver 2.4.0)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES

Video I/O:
DC1394: NO
FFMPEG: YES (prebuilt binaries)
avcodec: YES (58.134.100)
avformat: YES (58.76.100)
avutil: YES (56.70.100)
swscale: YES (5.9.100)
avresample: YES (4.0.0)
GStreamer: NO
DirectShow: YES

Parallel framework: none

Trace: YES (built-in)

Other third-party libraries:
Lapack: NO
Eigen: YES (ver 3.3.7)
Custom HAL: NO
Protobuf: build (3.19.1)

OpenCL: YES (no extra features)
Include path: C:/Users/pgjgg/Desktop/CODE/opencv/3rdparty/include/opencl/1.2
Link libraries: Dynamic load

Python 3:
Interpreter: C:/Users/pgjgg/AppData/Local/Programs/Python/Python39/python.exe (ver 3.9.7)
Libraries: C:/Users/pgjgg/AppData/Local/Programs/Python/Python39/libs/python39.lib (ver 3.9.7)
numpy: C:/Users/pgjgg/AppData/Local/Programs/Python/Python39/lib/site-packages/numpy/core/include (ver 1.22.3)
install path: C:/Users/pgjgg/AppData/Local/Programs/Python/Python39/Lib/site-packages/cv2/python-3.9

Python (for build): C:/Users/pgjgg/AppData/Local/Programs/Python/Python39/python.exe

Java:
ant: NO
JNI: C:/android/openjdk-11+28_windows-x64_bin/jdk-11/include C:/android/openjdk-11+28_windows-x64_bin/jdk-11/include/win32 C:/android/openjdk-11+28_windows-x64_bin/jdk-11/include
Java wrappers: NO
Java tests: NO

Install to: C:/Users/pgjgg/Desktop/CODE/opencv/buildOpenGL/install

Configuring done
Generating done

试了我一个通宵,遇到过一些问题。

比如编译完没有highgui模块。

这个是因为VTK没有带上QT编译。

还有sfm模块编译不了,取消build这个模块即可。

opencv4.5.5+qt5.15.2+vtk9.1+mingw81_64编译记录

编译OK截图

opencv4.5.5+qt5.15.2+vtk9.1+mingw81_64编译记录

opencv4.5.5+qt5.15.2+vtk9.1+mingw81_64编译记录

opencv4.5.5+qt5.15.2+vtk9.1+mingw81_64编译记录

四 参考链接

下载不再卡顿,OpenCV中国镜像启用 – 知乎 (zhihu.com)

(12条消息) 【CMake】Win10 + CMake + MinGW 简单使用_zhaotun123的博客-CSDN博客_cmake mingw

(15条消息) windows下更改CMake编译器为MinGW_罗伯特祥的博客-CSDN博客_cmake windows指定编译器

(15条消息) Opencv编译出现”In-source builds are not allowed”_景天的天的博客-CSDN博客

OpenCV / Opencv Zoo · GitCode

opencv的MinGW-W64编译 – 知乎 (zhihu.com)

(12条消息) QT5.14.2 + Cmake3.18 + OPENCV3.4.3 + Opencv_contrib3.4.3_周健文的博客-CSDN博客

(12条消息) CMake Error at cmake/OpenCVModule.cmake:288 (message): No modules has been found:_yogurt_的博客-CSDN博客

(13条消息) Qt、MinGW编译OpenCV 4.5.4(包含opencv_contrib)详细过程_雍正不秃头的博客-CSDN博客_qt编译opencv

(12条消息) Mingw编译opencv4.4+contrib4.4后的库文件_opencv+contrib编好qt-C++文档类资源-CSDN文库

(15条消息) 关于QT下配置OpenCV3.4.0后出现 error: undefined reference to ‘cv::xxx’的问题及解决方案_HerofH_的博客-CSDN博客

(15条消息) 如何去掉cmake编译OpenCV时的Cmake Warning:”OpenCVGenSetupVars.cmake:54″_Striveallen的博客-CSDN博客_cmake warning可以忽略吗

Original: https://blog.csdn.net/yantuguiguziPGJ/article/details/124875177
Author: yantuguiguziPGJ
Title: opencv4.5.5+qt5.15.2+vtk9.1+mingw81_64编译记录

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/703903/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球