Ask Your Question

cuda_*** objects crash in 4.5 (Python)

asked 2020-11-06 05:09:29 -0500

Rayndell gravatar image

I built OpenCV 4.5 with CUDA support (CUDA 11.0, cuDNN 8.0) and contrib modules. Everything went fine in the compiling and installation, and some cuda functions works well, as cv2.cuda.bilinarFilter for example.

It seems however that objects beginning with cuda_ tends to crash without any error message, with the first method call involving these objects. This type of code crashes all the time:

import cv2 linesDetector = cv2.cuda_HoughLinesDetector() linesDetector.setThreshold(80)

It is not a CUDA-related problem in my opinion since other cuda built-in functions work properly. Am I using these objects wrong? I also tested cuda_CannyEdgeDetector with the same result.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2020-11-06 07:04:46 -0500

berak gravatar image

updated 2020-11-06 10:58:37 -0500

It is not a CUDA-related problem in my opinion

that's right, there is indeed some bug in the python wrappers, that allows you to write code like this:

cd = cv2.cuda_CannyEdgeDetector() # invalid object !

where you would have to use a factory function:

cd = cv2.cuda.createCannyEdgeDetector(...)

same applies for:

hd = cv2.cuda.createHoughLinesDetector(...)
edit flag offensive delete link more


Oh yes, as in the C++ API. Indeed it works with these factory functions, thank you very much. The problem is that I wasn't able to find documentation or reference for these functions anywhere, even when typing help(cv2.cuda) in the Python prompt.

Rayndell gravatar imageRayndell ( 2020-11-06 07:42:54 -0500 )edit

Question Tools

1 follower


Asked: 2020-11-06 05:09:29 -0500

Seen: 258 times

Last updated: Nov 06 '20