opencv / opencv_contrib

Repository for OpenCV's extra modules
Apache License 2.0
9.39k stars 5.76k forks source link

any ideal with opencv480 no working with cv2.cudacodec.createVideoReader #3547

Closed summm closed 1 year ago

summm commented 1 year ago

any ideal why it`s no workon? thanks

NVIDIA CUDA:                   YES (ver 12.1, CUFFT CUBLAS FAST_MATH)
    NVIDIA GPU arch:             50 52 60 61 70 75 80 86 89 90
    NVIDIA PTX archs:

  cuDNN:                         YES (ver 8.9.0)

  OpenCL:                        YES (NVD3D11)
    Include path:                D:/python/opencv480/opencv480/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  Python 3:
    Interpreter:                 D:/python/Python311/python.exe (ver 3.11.4)
    Libraries:                   D:/python/Python311/libs/python311.lib (ver 3.11.4)
    numpy:                       D:/python/Python311/Lib/site-packages/numpy/core/include (ver 1.25.1)
    install path:                D:/python/Python311/Lib/site-packages/cv2/python-3.11

  Python (for build):            D:/python/Python311/python.exe

  Install to:                    D:/python/opencv480/build/install
#opencvtest.py

import cv2
import time

cap = cv2.cudacodec.createVideoReader("D:/obsrecord/test.mp4")

while True:
    ret, frame = cap.nextFrame()
    if not ret:

        break
    cv2.imshow("vid", frame.download())
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
D:\python\Python311\python.exe D:\code\python\normalpy311\opencvtest.py 
Traceback (most recent call last):
  File "D:\code\python\normalpy311\opencvtest.py", line 4, in <module>
    cap = cv2.cudacodec.createVideoReader("D:/obsrecord/test.mp4")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
cv2.error: OpenCV(4.8.0) D:\python\opencv480\opencv480\modules\core\include\opencv2/core/private.cuda.hpp:112: error: (-213:The function/feature is not implemented) The called functionality is disabled for current build or platform in function 'throw_no_cuda'
cudawarped commented 1 year ago

That error means the version of OpenCV you imported was not built with CUDA, can you check that you are importing the version of OpenCV you built by checking the result of

print(cv2.getBuildInformation())
summm commented 1 year ago

@cudawarped

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

  Extra modules:
    Location (extra):            D:/python/opencv480/opencvcontrib480/modules
    Version control (extra):     unknown

  Platform:
    Timestamp:                   2023-08-08T09:02:12Z
    Host:                        Windows 10.0.22621 AMD64
    CMake:                       3.26.4
    CMake generator:             Visual Studio 16 2019
    CMake build tool:            C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe
    MSVC:                        1929
    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 (16 files):         + SSSE3 SSE4_1
      SSE4_2 (1 files):          + SSSE3 SSE4_1 POPCNT SSE4_2
      FP16 (0 files):            + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
      AVX (7 files):             + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
      AVX2 (35 files):           + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
      AVX512_SKX (5 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:                C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe  (ver 19.29.30151.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 /wd4819 /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 /wd4819 /MP  /MDd /Zi /Ob0 /Od /RTC1 
    C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/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/v12.1/lib/x64
    3rdparty dependencies:

  OpenCV modules:
    To be built:                 aruco 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 python3 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_tests
    Disabled by dependency:      -
    Unavailable:                 alphamat cvv freetype hdf java julia matlab ovis python2 python2 sfm viz
    Applications:                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.13)
    JPEG:                        build-libjpeg-turbo (ver 2.1.3-62)
      SIMD Support Request:      YES
      SIMD Support:              NO
    WEBP:                        build (ver encoder: 0x020f)
    PNG:                         build (ver 1.6.37)
    TIFF:                        build (ver 42 - 4.2.0)
    JPEG 2000:                   build (ver 2.5.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:                   2021.8 [2021.8.0]
           at:                   D:/python/opencv480/build/3rdparty/ippicv/ippicv_win/icv
    Intel IPP IW:                sources (2021.8.0)
              at:                D:/python/opencv480/build/3rdparty/ippicv/ippicv_win/iw
    Lapack:                      NO
    Eigen:                       NO
    Custom HAL:                  NO
    Protobuf:                    build (3.19.1)
    Flatbuffers:                 builtin/3rdparty (23.5.9)

  NVIDIA CUDA:                   YES (ver 12.1, CUFFT CUBLAS FAST_MATH)
    NVIDIA GPU arch:             50 52 60 61 70 75 80 86 89 90
    NVIDIA PTX archs:

  cuDNN:                         YES (ver 8.9.0)

  OpenCL:                        YES (NVD3D11)
    Include path:                D:/python/opencv480/opencv480/3rdparty/include/opencl/1.2
    Link libraries:              Dynamic load

  Python 3:
    Interpreter:                 D:/python/Python311/python.exe (ver 3.11.4)
    Libraries:                   D:/python/Python311/libs/python311.lib (ver 3.11.4)
    numpy:                       D:/python/Python311/Lib/site-packages/numpy/core/include (ver 1.25.1)
    install path:                D:/python/Python311/Lib/site-packages/cv2/python-3.11

  Python (for build):            D:/python/Python311/python.exe

  Install to:                    D:/python/opencv480/build/install
-----------------------------------------------------------------
cudawarped commented 1 year ago

NVIDIA CUDA: YES (ver 12.1, CUFFT CUBLAS FAST_MATH) NVIDIA GPU arch: 50 52 60 61 70 75 80 86 89 90 NVIDIA PTX archs:

Apologies I should have read your initial post more clearly. You haven't compiled against the Nvidia Video Codec SDK.

Installation instructions can be found under item (5) from Build OpenCV (including Python) with CUDA on Windows.

summm commented 1 year ago

@cudawarped thanks i will try it