Compile and Install OpenCV for Nvidia Nano

Spread the love

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.

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’.

The following script will give you 4GB of Swap. To increase the swap size change the -g 4 parameter. (i.e -g 8, for 8GB of swap.)

git clone

cd resizeSwapMemory

./ -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

cd buildOpenCV

./ |& tee openCV_build.log

sudo ldconfig -v
Compiling OpenCV

Check OpenCV installed.

python3 -c 'import cv2; print(cv2.__version__)'
Success!!! OpenCV installed.

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!!!

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.