Install OpenCV and TensorFlow on ODROID C2

JMoon Technologies
3 min readMar 31, 2018

Hardware Setup:
1. Odroid C2
2. 32/64GB eMMC module + eMMC module reader board
3. 5V/2A Adapter
4. HDMI Screen and HDMI Cable
5. 16GB USB drive for swap(optional)
6. Ethernet cable to connect C2 directly to Wifi router.

These are the final set of instructions that worked for OpenCV Installation on latest image of Ubuntu Mate for Odroid C2 (aka Ubuntu 16.04.3 LTS (v2.4)) and also worked on Debian Stretch (Debian-Stretch64–1.0–20180202-C2.img.xz found here).

# With Ubuntu Mate, login: odroid, pass: odroid, and all instructions below can be copy pasted as is
# With Debian, login: root, pass: odroid, and none of the instructions below need sudo

# Instructions after first boot of OS
sudo apt update
sudo apt upgrade
sudo apt dist-upgrade

# Only in case of Ubuntu Mate downloaded from Odroid Wiki
sudo apt install linux-image-c2

sudo reboot

# After it reboots (optional)
sudo apt autoremove

# OpenCV Dependencies
sudo apt-get install build-essential cmake
sudo apt-get install qt5-default libvtk6-dev
sudo apt-get install zlib1g-dev libjpeg-dev libwebp-dev libpng-dev libtiff5-dev libjasper-dev libopenexr-dev libgdal-dev

#This is all one line
sudo apt-get install libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev yasm libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev libxine2-dev

sudo apt-get install libtbb-dev libeigen3-dev

# Replace python3 with python if you're interested in working with python v2.x.x
# We're working with python v3.5.2
# Both are probably already installed so check their installed versions using "python2 -- version" and "python3 --version"
sudo apt-get install python3-dev python3-tk python3-numpy
sudo apt-get install ant default-jdk
sudo apt-get install doxygen
sudo apt-get install -y unzip wget

# Get OpenCV version 3.2.0 from the link. You can simply download the zip file by copy pasting the below link into your browser as well
# You can get the link to whatever version you need by going to https://opencv.org/releases.html and right-clicking on the "Sources" under that version.
wget https://github.com/opencv/opencv/archive/3.2.0.zip

# Change 3.2.0 to whatever version you just downloaded
unzip 3.2.0.zip
mv opencv-3.2.0 OpenCV

cd OpenCV
mkdir build
cd build
cmake -DWITH_QT=ON -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON -DWITH_XINE=ON -DBUILD_EXAMPLES=ON -DENABLE_PRECOMPILED_HEADERS=OFF ..

#This step will take about an hour or 2 on the Odroid C2. Takes a lot longer on the RPi3
make -j4
sudo make install
sudo ldconfig

# To check the OpenCV version installed
pkg-config --modversion opencv

During Installation of TensorFlow we had to do A LOT of google searches but have come up with these final instructions tested on Ubuntu Mate for Odroid C2 (so far).

# To create a swap memory on the USB Drive (optional)
sudo blkid
#Whatever the SDAx of the USB Drive is
umount /dev/sda1
sudo mkswap /dev/sda1
sudo swapon /dev/sda1
sudo swapon

# Install dependencies for Tensorflow
sudo apt-get install openjdk-8-jdk automake autoconf

# unzip and wget can be removed if you already installed it above during OpenCV after the doxygen instruction or leave it in just for good measure
sudo apt-get install curl zip unzip libtool swig libpng12-dev pkg-config git zip g++ unzip wget xz-utils

sudo apt-get install python3-pip
sudo -H pip3 install --upgrade pip

# Check the right version of TensorFlow you want to download from https://github.com/lhelontra/tensorflow-on-arm/releases and download the .whl file directly from the browser or use the wget command to do so
wget https://github.com/lhelontra/tensorflow-on-arm/releases/download/v1.7.0/tensorflow-1.7.0-cp35-none-linux_aarch64.whl

# Use the name of the downloaded file instead of tensorflow-1.7.0-cp35-none-linux_aarch64.whl
sudo pip3 install tensorflow-1.7.0-cp35-none-linux_aarch64.whl

# To check installed version of TensorFlow
pip3 show tensorflow
#OR
pip3 list | grep tensorflow

If the pip3 install command did not work you’ll have to follow the remaining steps here: https://github.com/lhelontra/tensorflow-on-arm
But in our case it did work perfectly. Takes a while, so be patient.

For more updates, errors and problems you might face, go to THIS LINK to solve errors as they come.

--

--