I am struggling to compile OpenCV with CUDA support on Jetpack 5 (Jetson Xavier). The install is working for Python2.7, but doesn’t seem to be recognised by Python3.8. I noticed that the installation placed a cv2 folder under the Python2.7 dist-packages, but under the Python3.8 site-packages.
These are the build flags I used:
local CMAKEFLAGS="
-D BUILD_EXAMPLES=OFF
-D INSTALL_PYTHON_EXAMPLES=OFF
-D BUILD_opencv_python2=ON
-D BUILD_opencv_python3=ON
-D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=${PREFIX}
-D CUDA_ARCH_BIN=7.2
-D CUDA_ARCH_PTX=
-D CUDA_FAST_MATH=ON
-D EIGEN_INCLUDE_PATH=/usr/include/eigen3
-D ENABLE_NEON=ON
-D OPENCV_DNN_CUDA=ON
-D OPENCV_ENABLE_NONFREE=ON
-D OPENCV_EXTRA_MODULES_PATH=/tmp/build_opencv/opencv_contrib/modules
-D OPENCV_GENERATE_PKGCONFIG=ON
-D WITH_CUBLAS=ON
-D WITH_CUDA=ON
-D WITH_CUDNN=ON
-D WITH_GSTREAMER=ON
-D WITH_LIBV4L=ON
-D WITH_OPENGL=ON"
Based on this script: nano_build_opencv/build_opencv.sh at master · mdegans/nano_build_opencv · GitHub