This guide uses the "minimal" (headless) Ubuntu installation.
ODROID provides images for Ubuntu 18.04 here
This guide is using build 20190806
Download this and flash it to a MicroSD card. I couldn't find an md5 for it, but it worked for me, and the sum for mine is 25d47739748c23109c218cfdca4e3ffd
.
Ensure the white switch is set to MMC
(right-position). Then simply plug in the MicroSD card, turn on the ODROID, and Ubuntu should start up.
Default username/password is root
/odroid
.
I would recommend doing the rest of this via SSH, but it's up to you. From another linux host, use ssh-copy-id
to get your credentials over, and then SSH in
apt update -y && apt full-upgrade -y
apt install python3.8 python3.8-dev python3.8-venv python3-pip
Set up a virtual environment for OpenCV:
mkdir ~/venvs
python3.8 -m venv ~/venvs/3.8_env
source ~/venvs/3.8_env/bin/activate
Now we need to install the dependencies for OpenCV:
apt install libatlas-base-dev gfortran
pip install numpy
There's not pre-built binaries for ARM (as far as I can tell), so we'll need to build them ourselvs. Note that we are turning off the GUI features -- it's a headless installation, after all.
mkdir ~/opencv
cd ~/opencv
# Get latest OpenCV source
wget https://github.com/opencv/opencv/archive/4.2.0.tar.gz
tar -xf ./4.2.0.tar.gz
cd opencv-4.2.0
mkdir build
cd build
# Turn examples and GUI off to save time (probably wouldn't work anyway)
cmake \
-D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=OFF \
-D BUILD_EXAMPLES=OFF \
-DWITH_QT=OFF \
-DWITH_GTK=OFF \
../
# ~45 minutes
make -j6 # We have 6 cores, so why not
make install
ldconfig
ln -s /usr/local/lib/python3.8/site-packages/cv2/python-3.8/cv2.cpython-38-aarch64-linux-gnu.so /usr/local/lib/python3.8/site-packages/cv2/python-3.8/cv2.so
ln -s /usr/local/lib/python3.8/site-packages/cv2/python-3.8/cv2.so $VIRTUAL_ENV/lib/python3.8/site-packages/cv2.so
# This should print out 4.2.0
python -c "import cv2; print(cv2.__version__)"