OpenCV4Tegra issues with cv.cuda.createBackgroundSubtractorMOG2

I assume the current Jetpack downloads and installs OpenCV4Tegra which has CUDA support. To use OpenCV4Tegra, all that is needed in a Python3 script is to use the following commnad:

“import cv2”

Furthermore, if I want to use CUDA optimized MOG2 background subtraction I would have to use this command:

device = cv.cuda.createBackgroundSubtractorMOG2()

where the “device” is any variable.

If, that is the case, why when I run a program trying to use CUDA enhanced MOG2, do I get this error:

AttributeError: module ‘cv2.cuda’ has no attribute 'createBackgroundSubtractorMOG2

Hi,
The OpenCV included in Jetpack release is 4.1.1 and it does not enable CUDA filters. You would need to enable it manually. Please try the script:
GitHub - mdegans/nano_build_opencv: Build OpenCV on Nvidia Jetson Nano

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.