OpenCV with CuDA

Hi,

In Orin, after sudo apt install nvidia-jetpack, I tried to run cv2.cuda.getCudaEnabledDeviceCount(). It returned zero! Is the OpenCV installed with CUDA or not?

Best regards,
Naveen

Hi @naveen.crasta, the pre-installed OpenCV doesn’t support CUDA. However, you can build OpenCV with CUDA/cuDNN support using the scripts from https://github.com/mdegans/nano_build_opencv/

Or I have some pre-built OpenCV binaries with CUDA/cuDNN support that you can download from here: OpenCV-4.5.0-aarch64.tar.gz

The steps used to install these binaries you can follow along with the script here: https://github.com/dusty-nv/jetson-containers/blob/be0dca3d19b30e64d129c92e93425c9ede40d65f/scripts/opencv_install.sh#L17

Normally I install these binaries into container, so you can use the l4t-pytorch, l4t-tensorflow, or l4t-ml containers for JetPack 5.x (L4T R34.1.x) and they will already have OpenCV+CUDA installed.

1 Like

Hi @dusty_nv,
Thanks for your reply. Do you have the script to create the DEB pkg? I would like to try to build DEB pkg in a Docker for 4.5.3.

Best regards,
Naveen

Hi Naveen, if you run make package, then OpenCV will build the debs.

I have a Dockerfile for building the OpenCV debs here:

1 Like

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