NVIDIA development board is arm64, so for the source will be replaced to support domestic source of arm64 (not described in detail, but very important)
1. Default has been installed on your jetson nano mirror and start. Open the control terminal, enter the following command dependent libraries
sudo apt-get update sudo apt-get upgrade sudo apt-get install build-essential python3 python3-dev python3-pip python3-pandas python3-opencv python3-h5py libhdf5-serial-dev hdf5-tools nano ntp
2. Install opencv
- OpenCV is the first step in building on the definition of swap space in Jetson Nano.
- Jetson Nano having 4GB RAM. This is not enough to build OpenCV from source. Therefore, we need to define swap space on Nano to prevent memory corruption
-
pip3 install virtualenv python3 -m virtualenv -p python3 env echo "source env/bin/activate" >> ~/.bashrc source ~/.bashrc
# Turn off swap sudo swapoff /var/swapfile # Allocates 4G of additional swap space at /var/swapfile sudo fallocate -l 4G /var/swapfile # Permissions sudo chmod 600 /var/swapfile # Make swap space sudo mkswap /var/swapfile # Turn on swap sudo swapon /var/swapfile # Automount swap space on reboot sudo bash -c 'echo "/var/swapfile swap swap defaults 0 0" >> /etc/fstab' # Reboot sudo reboot
Installation opencv dependencies, aptitude to operate by:
Update # sudo APT-GET Update sudo upgrade APT-GET # the Pre-requisites sudo aptitude install the unzip cmake Build-Essential pkg-config sudo aptitude install libjpeg-dev libpng-dev libtiff-dev sudo aptitude install the libavcodec-dev-dev libswscale- libavformat libv4l-dev dev sudo aptitude install libxvidcore-dev-dev libx264 # the following items will tell you there is a conflict, you first select n, y can choose after the second sudo aptitude install for libgtk-3-dev sudo aptitude install libatlas dev-gfortran the -base sudo aptitude install python3-dev
Download opencv4.1 source code (you can download their own good and then upload up linux, that is used to upload files xshell6 of rz)
# Create a directory for opencv mkdir -p projects/cv2 cd projects/cv2 # Download sources wget -O opencv.zip https://github.com/opencv/opencv/archive/4.1.0.zip wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/4.1.0.zip # Unzip unzip opencv.zip unzip opencv_contrib.zip # Rename mv opencv-4.1.0 opencv mv opencv_contrib-4.1.0 opencv_contrib
Enter the virtual environment
source ~/env/bin/activate # Install Numpy pip install numpy
Create a working paper
# Create a build directory cd projects/cv2/opencv mkdir build cd build
The following code is the path in the build operation
cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D INSTALL_C_EXAMPLES=OFF \ -D OPENCV_ENABLE_NONFREE=ON \ # Contrib path -D OPENCV_EXTRA_MODULES_PATH=~/projects/cv2/opencv_contrib/modules \ # Your virtual environment's Python executable # You need to specify the result of echo $(which python) -D PYTHON_EXECUTABLE=~/env/bin/python \ -D BUILD_EXAMPLES=ON ..
Upload the missing file (may be missing):
https://files.cnblogs.com/files/ikic/boostdesc_bgm.i,vgg_generated_48.i%E7%AD%89.rar
After downloading the above is good, which will put all the files to opencv_contrib / modules / xfeatures2d / src /
cd projects/cv2/opencv_contrib/modules/xfeatures2d/src/
And then upload all the files inside the rz xshell
Some would say that if uploading errors, one by one upload.
Uploaded back to build working directory after successful
cd projects/cv2/opencv/build
make -j2
During compilation, you encounter some problems:
Favorite quote pencil word blog (there was no screenshot):
This time, when they went to 73% of the error fatal error: features2d / test /
: No such file or directory
#include "features2d / the Test / test_detectors_regression.impl.hpp"
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~
Encounter this problem,
Is the first document a problem, the following two files in the folder are copied to opencv_contrib / modules / xfeatures2d / test
In open this file, modify the file nod.
After modify the file copy and paste the error
The following sentence into
#include "features2d / test / test_detectors_regression.impl.hpp"
and so on, where you modify the header include error where the file, which file is missing that will move over from opencv
These errors after modification operation (re-run)
make -j2
Until all run behind success
In the build installed opencv
# Install OpenCV sudo make install sudo ldconfig
The constructed OpenCV library linked to the virtual environment virtualenv
Go to the WHERE at The Folder # OpenCV's Native Library IS Built cd /usr/local/lib/python3.6/site-packages/cv2/python-3.6 ls # Rename (xxx is an alternative, after the results of ls to look at Back to modify) mv cv2.cpython-36m-xxx-linux-gnu.so cv2.so # Go to your Virtual Environments Site-Packages Standard Package Folder cd ~ / env / lib / python3.6 / Site-Packages Standard Package / # Symlink at The Native Library ln -s /usr/local/lib/python3.6/site-packages/cv2/python-3.6/cv2.so cv2.so
This is done