Hi - I have been trying to install cv2 with cuda support on a jetson nano using this guide:
It installs for both python 2 and 3 but in python 3 while I can import cv2 it does not seem to be picking up the opencv_contrib modules as per below:
Python 3.6.9 (default, Jan 26 2021, 15:33:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'cv2' has no attribute '__version__'
Python 2 works fine:
Python 2.7.17 (default, Feb 27 2021, 15:10:58)
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__version__
'4.5.2'
>>>
My make config (I had to add last 3 options as it wasn’t picking up python3 libraries):
cmake
-D CMAKE_BUILD_TYPE=RELEASE
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules
-D CMAKE_INSTALL_PREFIX=/usr
-D EIGEN_INCLUDE_PATH=/usr/include/eigen3
-D WITH_OPENCL=OFF
-D WITH_CUDA=ON
-D CUDA_ARCH_BIN=5.3
-D CUDA_ARCH_PTX=""
-D WITH_CUDNN=ON
-D WITH_CUBLAS=ON
-D ENABLE_FAST_MATH=ON
-D CUDA_FAST_MATH=ON
-D OPENCV_DNN_CUDA=ON
-D ENABLE_NEON=ON
-D WITH_QT=ON
-D WITH_OPENMP=ON
-D WITH_OPENGL=ON
-D BUILD_TIFF=ON
-D WITH_FFMPEG=ON
-D WITH_GSTREAMER=ON
-D WITH_TBB=ON
-D BUILD_TBB=ON
-D BUILD_TESTS=OFF
-D WITH_EIGEN=ON
-D WITH_V4L=ON
-D WITH_LIBV4L=ON
-D OPENCV_ENABLE_NONFREE=ON
-D INSTALL_C _EXAMPLES=OFF
-D INSTALL_PYTHON_EXAMPLES=OFF
-D BUILD_opencv_python3=TRUE
-D OPENCV_GENERATE_PKGCONFIG=ON
-D BUILD_EXAMPLES=OFF
-D PYTHON3_INCLUDE_DIR2:PATH=/usr/include/aarch64-linux-gnu/python3.6m/
-D PYTHON3_LIBRARY:FILEPATH=/usr/lib/aarch64-linux-gnu/libpython3.6m.so
-D PYTHON3_NUMPY_INCLUDE_DIRS:PATH=/usr/local/lib/python3.6/dist-packages/numpy/core/include
I’ve been banging my head against a wall with this for a couple of days now so any help gratefully received - thanks!