Skip to content

Python type stubs does not handle cuda::GpuMat and cuda::Stream #23945

@asmorkalov

Description

@asmorkalov

System Information

Python 3.6+
Platform: CUDA

Detailed description

'Failed to resolve "cv2.cudacodec" namespace against "cv2". 
Errors: [\'Failed to resolve "cv2.cudacodec.createVideoWriter" function against "cv2".
Errors: 
[0]: Failed to resolve "stream" argument: Failed to resolve "Stream" exposed as "Stream", 
[1]: Failed to resolve "stream" argument: Failed to resolve "Stream" exposed as "Stream"\', \'Failed to resolve "cv2.cudacodec.EncodeQp" class against "cv2". Errors: [\\\'Failed to resolve "qpInterP" property\\\', \\\'Failed to resolve "qpInterB" property\\\', \\\'Failed to resolve "qpIntra" property\\\']\', \'Failed to resolve "cv2.cudacodec.EncoderParams" class against "cv2". Errors: [\\\'Failed to resolve "targetQuality" property\\\']\', \'Failed to resolve "cv2.cudacodec.VideoReader" class against "cv2". Errors: [\\\'Failed to resolve "cv2.cudacodec.VideoReader.nextFrame" function against "cv2". Errors: [0]: Failed to resolve "frame" argument: Failed to resolve one of "GpuMat | None" items. Errors: [\\\\\\\'Failed to resolve "GpuMat" exposed as "GpuMat"\\\\\\\'], [1]: Failed to resolve "stream" argument: Failed to resolve "Stream" exposed as "Stream", 
[2]: Failed to resolve return type: Failed to resolve one of "tuple[bool, GpuMat]" items. Errors: [\\\\\\\'Failed to resolve "GpuMat" exposed as "GpuMat"\\\\\\\']\\\', \\\'Failed to resolve "cv2.cudacodec.VideoReader.grab" function against "cv2". Errors: [0]: Failed to resolve "stream" argument: Failed to resolve "Stream" exposed as "Stream"\\\', \\\'Failed to resolve "cv2.cudacodec.VideoReader.retrieve" function against "cv2". Errors: 
[0]: Failed to resolve "frame" argument: Failed to resolve one of "GpuMat | None" items. Errors: [\\\\\\\'Failed to resolve "GpuMat" exposed as "GpuMat"\\\\\\\'], 
[1]: Failed to resolve return type: Failed to resolve one of "tuple[bool, GpuMat]" items. Errors: [\\\\\\\'Failed to resolve "GpuMat" exposed as "GpuMat"\\\\\\\']\\\']\']']

Steps to reproduce

CMake options that work:
cmake -DBUILD_opencv_cudacodec=OFF -DBUILD_opencv_cudaoptflow=OFF -DPYTHON3_EXECUTABLE=which python3.8 -DPYTHON_DEFAULT_EXECUTABLE=which python3.8 -DWITH_CUDA=ON -DCUDA_ARCH_BIN=61 -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules/ ../opencv-master

CMake options that doe not:
cmake -DBUILD_opencv_cudaoptflow=OFF -DPYTHON3_EXECUTABLE=which python3.8 -DPYTHON_DEFAULT_EXECUTABLE=which python3.8 -DWITH_CUDA=ON -DCUDA_ARCH_BIN=61 -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules/ ../opencv-master

CUDA definitions for Python: https://github.com/opencv/opencv/blob/4.x/modules/core/misc/python/pyopencv_cuda.hpp

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions