当前位置:   article > 正文

Win10 OpenCV编译安装CUDA版本_windows module opencv_ovis disabled because ogre3d

windows module opencv_ovis disabled because ogre3d was not found

Win10 + Microsoft Visual Studio Community 2017 + CUDA11.3 + CUDNN8.2 + RTX GeForce 3090 + OpenCV4.5.3

Microsoft Visual Studio安装

前往官网下载Visual Studio Installer即可,做如下勾选,安装即可
在这里插入图片描述
完成后,查看环境变量,将MSVC编译器地址加入环境变量

D:\programming\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x64
  • 1

在这里插入图片描述

安装CUDA和CUDNN

前往官网下载CUDA和对应的CUDNN,切记一定要对应CUDNN和CUDA版本,根据提示一步一步安装即可,完成后将CUDNN解压,替换C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.3下的对应文件
在这里插入图片描述

OpenCV源码下载

进入OpenCV官网,选择自己需要的版本,例如OpenCV-4.5.3
在这里插入图片描述
进入OpenCV GitHub官方仓库,通过tags选择对应的contrib版本
在这里插入图片描述

CMake安装与设置

进入CMake官网,下载最新版就行,我这里下载的CMake 3.24.0-rc4
在这里插入图片描述
中间需要多次点击”configure“

  • (1) BUILD_opencv_world
    勾选 BUILD_opencv_world:此项的目的是生成一个dll文件,比如:opencv_world430d.dll。

  • (2) OPENCV_DNN_CUDA
    勾选OPENCV_DNN_CUDA

  • (3)OPENCV_ENABLE_NONFREE
    勾选 OPENCV_ENABLE_NONFREE:此项目的是编译contrib模块。

  • (4) OPENCV_EXTRA_MODULES_PATH
    设置OPENCV_EXTRA_MODULES_PATH:设置contrib模块的目录:(注意一定到modules这个目录)

  • (5) WITH_CUDA
    勾选WITH_CUDA。

  • (6) CUDA_ARCH_BIN
    设置自己的算力大小,参考这里,我这里设置是8.6。如果查不到此项,请configure一次。
    在这里插入图片描述

  • (7) WITH_CUDNN
    勾选 WITH_CUDNN。如果查不到此项,请configure一次。

  • (8) CUDA_FAST_MATH
    勾选CUDA_FAST_MATH。

  • (9) python和java相关组件
    如果不使用python和java就将如下python和java相关的对应项的”√“去掉。(因版本不同,组件名称不一定一样,请根据实际选择)

  • (10) 其他
    其他的选项就根据自己喜好设定,比如test模块等。

以上经过多次点击”Configure“,确定没有任何错误提示信息。
等待Configure完成之后,查看是否检测到了CUDA和cuDNN,都出现YES之后,说明没有问题。如果没有检测到的话,需要确认是否CUDA和cuDNN版本正确,否则后面的编译将不会编译CUDA模块,白白浪费时间。确认之后,点击Generate,最终如下所示:
在这里插入图片描述

Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.19043.
Detected processor: AMD64
libjpeg-turbo: VERSION = 2.1.0, BUILD = opencv-4.5.3-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.3-openjp2-2.4.0
OpenJPEG libraries will be built from sources: libopenjp2 (version "2.4.0")
found Intel IPP (ICV version): 2020.0.0 [2020.0.0 Gold]
at: H:/programming/opencvbuild/3rdparty/ippicv/ippicv_win/icv
found Intel IPP Integration Wrappers sources: 2020.0.0
at: H:/programming/opencvbuild/3rdparty/ippicv/ippicv_win/iw
CUDA detected: 11.3
CUDA: Using CUDA_ARCH_BIN=8.6
CUDA NVCC target flags: -gencode;arch=compute_86,code=sm_86;-D_FORCE_INLINES
CUDA: MSVS generator is detected. Disabling CMake re-run checks (CMAKE_SUPPRESS_REGENERATION=ON). You need to run CMake manually if updates are required.
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.

VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
OpenCV Python: during development append to PYTHONPATH: H:/programming/opencvbuild/python_loader
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
Module opencv_alphamat disabled because the following dependencies are not found: Eigen
freetype2:   NO
harfbuzz:    NO
Julia not found. Not compiling Julia Bindings. 
Module opencv_ovis disabled because OGRE3D was not found
No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags
Tesseract:   NO
Processing WORLD modules...
    module opencv_cudev...
    module opencv_core...
Allocator metrics storage type: 'long long'
    module opencv_cudaarithm...
    module opencv_flann...
    module opencv_imgproc...
    module opencv_intensity_transform...
    module opencv_ml...
    module opencv_phase_unwrapping...
    module opencv_plot...
    module opencv_quality...
    module opencv_reg...
    module opencv_surface_matching...
    module opencv_cudafilters...
    module opencv_cudaimgproc...
    module opencv_cudawarping...
    module opencv_dnn...
Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': H:/programming/opencv/sources/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
    module opencv_dnn_superres...
    module opencv_features2d...
    module opencv_fuzzy...
    module opencv_hfs...
    module opencv_imgcodecs...
    module opencv_line_descriptor...
    module opencv_photo...
    module opencv_saliency...
    module opencv_text...
    module opencv_videoio...
    module opencv_wechat_qrcode...
    module opencv_xphoto...
    module opencv_barcode...
    module opencv_calib3d...
    module opencv_cudacodec...
    module opencv_cudafeatures2d...
    module opencv_cudastereo...
    module opencv_datasets...
    module opencv_highgui...
highgui: using builtin backend: WIN32UI
    module opencv_mcc...
    module opencv_objdetect...
    module opencv_rapid...
    module opencv_rgbd...
rgbd: Eigen support is disabled. Eigen is Required for Posegraph optimization
    module opencv_shape...
    module opencv_structured_light...
    module opencv_video...
    module opencv_xfeatures2d...
    module opencv_ximgproc...
    module opencv_xobjdetect...
    module opencv_aruco...
    module opencv_bgsegm...
    module opencv_bioinspired...
    module opencv_ccalib...
    module opencv_cudabgsegm...
    module opencv_cudalegacy...
    module opencv_cudaobjdetect...
    module opencv_dnn_objdetect...
    module opencv_dpm...
    module opencv_face...
    module opencv_gapi...
    module opencv_optflow...
    module opencv_stitching...
    module opencv_tracking...
    module opencv_cudaoptflow...
Building with NVIDIA Optical Flow API 2.0
    module opencv_stereo...
    module opencv_superres...
    module opencv_videostab...
Processing WORLD modules... DONE

General configuration for OpenCV 4.5.3 =====================================
  Version control:               unknown

  Extra modules:
    Location (extra):            H:/programming/opencv_contrib-4.5.3/modules
    Version control (extra):     unknown

  Platform:
    Timestamp:                   2022-07-27T05:51:33Z
    Host:                        Windows 10.0.19043 AMD64
    CMake:                       3.24.0-rc4
    CMake generator:             Visual Studio 15 2017
    CMake build tool:            D:/programming/Microsoft Visual Studio/2017/Community/MSBuild/15.0/Bin/MSBuild.exe
    MSVC:                        1916
    Configuration:               Debug Release

  CPU/HW features:
    Baseline:                    SSE SSE2 SSE3
      requested:                 SSE3
    Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
      requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
      SSE4_1 (17 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 (31 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
      AVX512_SKX (7 files):      + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX

  C/C++:
    Built as dynamic libs?:      YES
    C++ standard:                11
    C++ Compiler:                D:/programming/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe  (ver 19.16.27045.0)
    C++ flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP  /MD /O2 /Ob2 /DNDEBUG 
    C++ flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP  /MDd /Zi /Ob0 /Od /RTC1 
    C Compiler:                  D:/programming/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x64/cl.exe
    C flags (Release):           /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:precise     /MP   /MD /O2 /Ob2 /DNDEBUG 
    C flags (Debug):             /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:precise     /MP /MDd /Zi /Ob0 /Od /RTC1 
    Linker flags (Release):      /machine:x64  /INCREMENTAL:NO 
    Linker flags (Debug):        /machine:x64  /debug /INCREMENTAL 
    ccache:                      NO
    Precompiled headers:         NO
    Extra dependencies:          cudart_static.lib nppc.lib nppial.lib nppicc.lib nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib cudnn.lib cufft.lib -LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.3/lib/x64
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 aruco barcode bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab wechat_qrcode world xfeatures2d ximgproc xobjdetect xphoto
    Disabled:                    java_bindings_generator python_bindings_generator python_tests
    Disabled by dependency:      -
    Unavailable:                 alphamat cvv freetype hdf java julia matlab ovis python2 python3 sfm viz
    Applications:                tests perf_tests apps
    Documentation:               NO
    Non-free algorithms:         YES

  Windows RT support:            NO

  GUI: 
    Win32 UI:                    YES
    VTK support:                 NO

  Media I/O: 
    ZLib:                        build (ver 1.2.11)
    JPEG:                        build-libjpeg-turbo (ver 2.1.0-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
    Media Foundation:            YES
      DXVA:                      YES

  Parallel framework:            Concurrency

  Trace:                         YES (with Intel ITT)

  Other third-party libraries:
    Intel IPP:                   2020.0.0 Gold [2020.0.0]
           at:                   H:/programming/opencvbuild/3rdparty/ippicv/ippicv_win/icv
    Intel IPP IW:                sources (2020.0.0)
              at:                H:/programming/opencvbuild/3rdparty/ippicv/ippicv_win/iw
    Lapack:                      NO
    Eigen:                       NO
    Custom HAL:                  NO
    Protobuf:                    build (3.5.1)

  NVIDIA CUDA:                   YES (ver 11.3, CUFFT CUBLAS FAST_MATH)
    NVIDIA GPU arch:             86
    NVIDIA PTX archs:

  cuDNN:                         YES (ver 8.2.1)

  OpenCL:                        YES (NVD3D11)
    Include path:                H:/programming/opencv/sources/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  Python (for build):            D:/programming/anaconda3/python.exe

  Install to:                    H:/programming/opencvbuild/install
-----------------------------------------------------------------

Configuring done
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222

工程编译及安装

ALL_BUILD,点击“Open Project”打开工程,在Release模式下右键点击ALL_BUILD,生成,时间较长(i7-11700k大概60分钟)
在这里插入图片描述
生成之后,右击INSTALL->仅用于项目->仅生成INSTALL
在这里插入图片描述
完成后,install文件夹就是我们需要的,至此就完成了OpenCV-CUDA的编译安装
在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/weixin_40725706/article/detail/119763
推荐阅读
相关标签
  

闽ICP备14008679号