How can i install opencv+contrib and CUDA

i just get Jetson Nano board last week, some rules that install opencv is diffculty for me, so anybody can help me? Thank!

This script will do that automatically.

Hi,

I am not sure that script works as expected.

The opencv version for python is 3.2 after using the script.
nvidia@nvidia:~/CSI-Camera$ python
Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15)
[GCC 7.3.0] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import cv2
cv2.version
‘3.2.0’
exit()
nvidia@nvidia:~/CSI-Camera$ python3
Python 3.6.7 (default, Oct 22 2018, 11:32:17)
[GCC 8.2.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
import cv2
cv2.version
‘3.2.0’
exit()

I was also trying to access the CSI Camera after using this script using the code from the jetsonhacksnano repository (GitHub - JetsonHacksNano/CSI-Camera: Simple example of using a CSI-Camera (like the Raspberry Pi Version 2 camera) with the NVIDIA Jetson Developer Kit).
I think it is unable to access the gstreamer pipeline anymore from python because of the lower OpenCV version.

nvidia@nvidia:~/CSI-Camera$ python simple_camera.py
nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)NV12, framerate=(fraction)60/1 ! nvvidconv flip-method=0 ! video/x-raw, width=(int)1280, height=(int)720, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink
Unable to open camera

This code was working to access the CSI camera before the above mentioned script was used for installation.

Cheers,
Ritvik

Hi,

Quick update, I think the script is supposed to install opencv 4.0.0 but even the c++ version is still 3.3.1

Checked with this code:
#include “opencv2/opencv.hpp”

using namespace cv;
using namespace std;

int main( int argc, char** argv ){
cout << "OpenCV Version: " << CV_VERSION << endl;
}

Output:
nvidia@nvidia:~$ g++ opencv_version.cpp -o opencv_version pkg-config --cflags --libs opencv
nvidia@nvidia:~$ ./opencv_version
OpenCV Version: 3.3.1

ok,i will try it.thanks.

Hi,

So I found out what the issue was.
The Nano is overheating without the fan and its RAM is getting full during the installation process.
Hence the installation process was getting killed and was not completing successfully.

I kept the Nano under a fan and created a 4GB swapfile as indicated in this post:
https://devtalk.nvidia.com/default/topic/1049296/jetson-nano/how-to-install-opencv-python-for-python3-6/2

After this the script completed successfully upon execution.

Cheers,
Ritvik