jingweimo的个人博客分享 http://blog.sciencenet.cn/u/jingweimo

博文

Build OpenCV4.0.1 contrib modules with Cuda enabled

已有 4061 次阅读 2019-3-24 22:48 |系统分类:科研笔记

General configuration for OpenCV 4.0.1 =====================================

Version control:               unknown


Extra modules:

Location (extra):            D:/Software/Programming/OpenCV/opencv_contrib-4.0.1/modules

Version control (extra):     unknown


Platform:

Timestamp:                   2019-03-23T15:52:48Z

Host:                        Windows 10.0.17763 AMD64

CMake:                       3.13.4

CMake generator:             Visual Studio 14 2015 Win64

CMake build tool:            C:/Program Files (x86)/MSBuild/14.0/bin/MSBuild.exe

MSVC:                        1900


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 (7 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 (13 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2


C/C++:

Built as dynamic libs?:      YES

C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe  (ver 19.0.24215.1)

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      /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP4   /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      /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP4   /MDd /Zi /Ob0 /Od /RTC1

C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/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        /MP4    /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        /MP4  /MDd /Zi /Ob0 /Od /RTC1

Linker flags (Release):      /machine:x64  /INCREMENTAL:NO

Linker flags (Debug):        /machine:x64  /debug /INCREMENTAL

ccache:                      NO

Precompiled headers:         YES

Extra dependencies:          cudart.lib nppc.lib nppial.lib nppicc.lib nppicom.lib nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib cufft.lib -LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.0/lib/x64

3rdparty dependencies:


OpenCV modules:

To be built:                 bioinspired calib3d core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudastereo cudawarping cudev dnn dnn_objdetect features2d flann gapi highgui imgcodecs imgproc java_bindings_generator ml objdetect phase_unwrapping photo plot python_bindings_generator reg saliency shape stereo stitching structured_light surface_matching tracking ts video videoio xfeatures2d ximgproc xobjdetect xphoto

Disabled:                    superres world

Disabled by dependency:      cudaoptflow

Unavailable:                 java js python2 python3

Applications:                tests apps

Documentation:               NO

Non-free algorithms:         NO


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 1.5.3-62)

WEBP:                        build (ver encoder: 0x020e)

TIFF:                        build (ver 42 - 4.0.9)

JPEG 2000:                   build (ver 1.900.1)

OpenEXR:                     build (ver 1.7.1)

HDR:                         YES

SUNRASTER:                   YES

PXM:                         YES

PFM:                         YES


Video I/O:

DC1394:                      NO

FFMPEG:                      YES (prebuilt binaries)

avcodec:                   YES (ver 58.35.100)

avformat:                  YES (ver 58.20.100)

avutil:                    YES (ver 56.22.100)

swscale:                   YES (ver 5.3.100)

avresample:                YES (ver 4.0.0)

GStreamer:                   NO

DirectShow:                  YES

Media Foundation:            YES

DXVA:                      NO


Parallel framework:            Concurrency


Trace:                         YES (with Intel ITT)


Other third-party libraries:

Intel IPP:                   2019.0.0 Gold [2019.0.0]

at:                   C:/opencv-4.0/cmake-build/3rdparty/ippicv/ippicv_win/icv

Intel IPP IW:                sources (2019.0.0)

at:                C:/opencv-4.0/cmake-build/3rdparty/ippicv/ippicv_win/iw

Lapack:                      NO

Eigen:                       NO

Custom HAL:                  NO

Protobuf:                    build (3.5.1)


NVIDIA CUDA:                   YES (ver 9.0, CUFFT CUBLAS NVCUVID FAST_MATH)

NVIDIA GPU arch:             30 35 37 50 52 60 61 70

NVIDIA PTX archs:


OpenCL:                        YES (no extra features)

Include path:                D:/Software/Programming/opencv-4.0.1/opencv-4.0.1/3rdparty/include/opencl/1.2

Link libraries:              Dynamic load


Python (for build):            C:/Python36/python.exe


Java:

ant:                         NO

JNI:                         C:/Java/include C:/Java/include/win32 C:/Java/include

Java wrappers:               NO

Java tests:                  NO


Install to:                    C:/opencv-4.0/mybuild

-----------------------------------------------------------------



Note:

  1. Cancel ‘CUDA_ATTACH_VS_BUILD_RULE_TO_CUDA_FILE’, otherwise you’ll have some CUDA related errors (LNK1104 cannot open file); enable CUDA_FAST_MATH.

  2. Choose ‘WITH_CUBLAS’, ‘WITH_CUDA’, ‘WITH_OPENGL’, ‘WITH_TBB’ (TBB is optional)

  3. Update cuda driver if needed (https://docs.nvidia.com/deploy/cuda-compatibility/index.html)


Test:

#include "opencv2/opencv.hpp"
using namespace cv;

cuda::GpuMat dst, src;
src.upload(cameraman); //read cameraman.jpg into Mat cameraman
cuda::threshold(src,dst,128.0,255.0,THRESH_BINARY);
Mat result;
dst.download(result);
imshow("Result",result);
waitKey();


References:

https://jamesbowley.co.uk/opencv-3-4-gpu-cuda-performance-comparison-nvidia-vs-intel/

http://answers.opencv.org/question/200431/whats-the-future-of-cuda-modules-after-opencv-4/

http://answers.opencv.org/question/205673/building-opencv-with-cuda-win10-vs-2017/

https://initialneil.wordpress.com/2014/09/25/opencv-2-4-9-cuda-6-5-visual-studio-2013/

https://stackoverflow.com/questions/25929747/link-fatal-error-lnk1104-cannot-open-file-opencv-gpu249d-lib

https://github.com/opencv/opencv/issues/9908

https://www.pyimagesearch.com/2016/07/11/compiling-opencv-with-cuda-support/

http://on-demand.gputechconf.com/gtc/2013/webinar/gtc-express-itseez-opencv-webinar.pdf

https://docs.opencv.org/4.0.1/d0/d60/classcv_1_1cuda_1_1GpuMat.html

https://developer.dji.com/onboard-sdk/documentation/sample-doc/advanced-sensing-stereo-depth-perception.html



https://blog.sciencenet.cn/blog-578676-1169425.html

上一篇:[转载]Qt Has a Solution for All Your Timing Needs
下一篇:[转载]OpenCV GPU CUDA Performance Comparison (nvidia vs intel)
收藏 IP: 35.10.57.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-11-19 11:44

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部