Developing Realsense Application on UP Squared Board

Install Ubuntu 16.04:

Flash the image on a USB stick and install on Up2 Board.

Update the system:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

At this point I received some errors like:

W: Possible missing firmware /lib/firmware/i915/kbl_guc_ver9_14.bin for module i915
W: Possible missing firmware /lib/firmware/i915/bxt_guc_ver8_7.bin for module i915

I installed the missing firmware files which I downloaded from https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915.

sudo cp kbl_guc_ver9_14.bin /lib/firmware/i915 
sudo cp bxt_guc_ver8_7.bin /lib/firmware/i915

 

sudo update-grub && sudo reboot

# verify that you have a supported kernel version (4.4.0-.., 4.8.0-.., 4.10.0-.. , 4.13.0-..or 4.15.0-.. as of May 2018)
uname -r

 

Install CMake

Download the source code from https://cmake.org/download/.

./bootstrap
make
make install

 

Install OpenCV

# To build
sudo apt-get install build-essential 
sudo apt-get install git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev

# To process images:
sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

# To process videos:
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev

# For GUI:
sudo apt-get install libgtk-3-dev

# For optimization
sudo apt-get install libatlas-base-dev gfortran pylint

# To build for Python2 and Python3
sudo apt-get install python2.7-dev python3.5-dev
wget https://github.com/opencv/opencv/archive/3.4.0.zip -O opencv-3.4.0.zip

wget https://github.com/opencv/opencv_contrib/archive/3.4.0.zip -O opencv_contrib-3.4.0.zip

sudo apt-get install unzip
unzip opencv-3.4.0.zip
unzip opencv_contrib-3.4.0.zip

cd  opencv-3.4.0
mkdir build
cd build

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.0/modules -DOPENCV_ENABLE_NONFREE=True ..


# Build
# Up2 Board has 2 cores
make -j2

# Install in the location /usr/local using command
sudo make install

# Reinitialize static libs using the following command
sudo ldconfig

Build librealsense

sudo apt-get install git libssl-dev libusb-1.0-0-dev pkg-config libgtk-3-dev

git clone https://github.com/IntelRealSense/librealsense

cd librealsense
sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/ 
sudo udevadm control --reload-rules && udevadm trigger 

# patch the kernel
./scripts/patch-realsense-ubuntu-lts.sh

# Build
mkdir build && cd build
cmake ../ -DBUILD_EXAMPLES=true -DBUILD_CV_EXAMPLES=true

sudo make uninstall
make clean
make -j2
sudo make install

Install QtCreator:

wget http://download.qt.io/official_releases/qt/5.7/5.7.0/qt-opensource-linux-x64-5.7.0.run

chmod +x qt-opensource-linux-x64-5.7.0.run
./qt-opensource-linux-x64-5.7.0.run

sudo apt-get install libfontconfig1

Launch Qt Creator

 

Resources:

 

TODO:

  • Check why OpenCV was not built for Python3.
  • Configure QtCreator