Prepare an SD Card
You will need an SD card with a recommended capacity of 62GB to build OpenCV as there is no enough disk space on the TX1. You will need to format it to ext4.
Use AOMEI partition assistant standard edition to format your SD card.
Update and Install Dependencies
sudo apt-get install build-essential sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
Removing an existing directory
If a directory already exists from a previous version or you need to start again, use the following command to remove the existing folder. Once removed, retry the install.
sudo rm -r opencv
Download OpenCV from Github
There is not enough disk space on the TX1 to compile OpenCV. You will need to build OpenCV on a SD card which has 64GB capacity.
To find your SD card path, enter the following commands.
cd /media/nvidia/CANON8 git clone https://github.com/opencv/opencv.git git clone https://github.com/opencv/opencv_contrib.git
fatal: destination path ‘opencv’ already exists and is not an empty directory.
Use command above to remove an existing directory.
sudo apt-get install cmake-qt-gui cmake-gui
Create a build folder on SD card
cd opencv mkdir build
From the linux CLI in the ‘/opencv/build’ folder enter the following command.
Nominate your source and build folders, then hit configure. After you have chosen your settings, choose generate.
We did not change any settings from the default settings.
Once you have generated the makefile, close the cmake-gui application.
Type ‘nproc’ from the CLI to detemine how many processor you have. Always use 1 less to prevent a crash. For example, I have four (4) processors, so I use ‘-j3’.
nproc make -j3
Install from Build.
sudo make install
Try the following command from Linux to see which active OpenCV version you have installed.
python3 -c 'import cv2; print(cv2.__version__)'
Open jtop and see if CUDA is working. Navigate to the last page to see if OpenCV has been installed with CUDA.
To install ‘jtop’, click the link below and follow the instructions.