How to install opencv(with CUDA) on Jetson Orin NX(8GB)?

I want to install the suitable version of opencv on my Jetson Orin NX board so that I can use it in qt and call the GPU for acceleration. Opencv installed by default in Jetpack doesn’t support CUDA.
I have tried to use the method form (Best way to install openCV with Cuda on Jetpack 5 (Xavier NX) : openCV for Tegra?) to install opencv4.6.0, but it was prompted that the v4l2ucp library is missing, and ubuntu20.04 no longer supports this library. I also tried downloading this library myself to install it, but during the installation process, it was prompted that qt4. x is required to install this library, and I have already installed qt5. x.

Here is the information about the version of the software that I am using:
aarch64
Jetpack 5.1.1
Ubuntu 20.04
qt 5.12.8
CUDA 11.4
cuDNN 8.6

Hi,

Please remove the v4l2ucp from the script and it should work.

sudo apt-get install -y libv4l-dev v4l-utils qv4l2

Thanks.

I tried this, but when I ran yolov5 using qt, my program reported an error. I used debug and found that there was SIGSEGV error while pushing the stack. However, this error did not occur before using opencv4.4.0. I thought it was a problem with the v4l2ucp package, but now it doesn’t seem like it is. I tried installing opencv4.7.0 again, but the error changed to vectordouble free. Have you encountered a similar situation?

Hi,

How do you run the YOLOv5 model?
Do you use Ultralytics’ sample with PyTorch?

If yes, please check if you are facing the same issue as below topic:

Thanks.

Thank you for your answer. In the end, I successfully installed opencv4.4.0 with the following configuration:
cmake \

-D CMAKE_BUILD_TYPE=Release \

-D ENABLE_CXX11=ON \

-D FFMPEG=ON \

-D CMAKE_INSTALL_PREFIX=/usr/local \

-D WITH_TBB=ON \

-D BUILD_NEW_PYTHON_SUPPORT=ON \

-D WITH_V4L=ON \

-D WITH_QT=ON \

-D WITH_OPENGL=ON \

-D WITH_GTK=ON \

-D WITH_GTK_2_X=ON \

-D OPENCV_EXTRA_MODULES_PATH=/home/developer/Library /opencv_contrib-4.4.0/modules \

-D WITH_CUDA=ON \

-D WITH_CUDNN=ON \

-D OPENCV_DNN_CUDA=ON \

-D CUDA_ARCH_BIN=“7.2,8.7” \

-D CUDA_ARCH_PTX=“” \

-D OPENCV_GENERATE_PKGCONFIG=ON \

-D WITH_GSTREAMER=ON \

-D WITH_LIBV4L=ON \

-D BUILD_opencv_python3=ON \

-D BUILD_TESTS=OFF \

-D BUILD_PERF_TESTS=OFF \

-D BUILD_EXAMPLES=OFF \