Update your Operating System
Follow the link below to update your operating system.
Download the Packages
Make sure you have pip3 installled.
sudo apt-get install python3-pip
Reboot the Nano.
Check current version of OpenCV
The jetpack image comes pre-installed with OpenCV. To check which version you have installed, enter the following command.
dpkg -l | grep libopencv
For more information on your OpenCV installation to check if Cuda is installed, follow these instructions and install jtop. http://brisbaneroboticsclub.id.au/measure-nvidia-nano-gpu-performance/
Once ‘jtop’ is installed, see if OpenCV is compiled for Cuda. The standard Jetpack image is NOT compiled for CUDA.
OpenCV operates much faster when it is compiled for Cuda.
Remove existing OpenCV (Optional)
sudo pip3 uninstall opencv-python
Increase swap file
Reduce crashes while compiling and compile faster.
Follow the instructions in the link below, however use this command in ‘For example’.
git clone https://github.com/JetsonHacksNano/resizeSwapMemory cd resizeSwapMemory ./setSwapMemorySize.sh -g 4 sudo reboot
Compile OpenCV using bash script.
Follow the link and follow the instructions OR go to the next section for our quick install guide.
For website instructions, please click the following link…
Enter these commands to Auto compile and install the latest version of OpenCV
Open the ‘System monitor’ to monitor CPU and swap file performance. The enter the following command lines to install and compile the most recent version of OpenCV.
git clone https://github.com/JetsonHacksNano/buildOpenCV cd buildOpenCV ./buildOpenCV.sh |& tee openCV_build.log sudo ldconfig -v
Check OpenCV installed.
python3 -c 'import cv2; print(cv2.__version__)'
Check OpenCV is installed for Cuda.
Follow the instruction in the link below to install ‘jtop” and see Cuda performance and statistics.
Success!! OpenCV is installed and compiled for Cuda!!!