Compile and Install OpenCV for Nvidia Nano

Spread the love
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Update your Operating System

sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade -y

Cleanup your unwanted files.

sudo apt autoremove

Download the Packages

Make sure you have pip3 installled.

sudo apt-get install python3-pip

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/

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

https://www.jetsonhacks.com/2019/11/28/jetson-nano-even-more-swap/

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…

https://www.jetsonhacks.com/2019/11/22/opencv-4-cuda-on-jetson-nano/

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.

http://brisbaneroboticsclub.id.au/measure-nvidia-nano-gpu-performance/

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.