Skip to content

Instantly share code, notes, and snippets.

@dmrib
Last active June 4, 2018 11:26
Show Gist options
  • Save dmrib/b2bc06ed8bcf583686e26af6b06f1675 to your computer and use it in GitHub Desktop.
Save dmrib/b2bc06ed8bcf583686e26af6b06f1675 to your computer and use it in GitHub Desktop.
Install dependencies, creates an environment for Tracking-Termites, clones repository at Desktop and creates a virtualenvnamed 'ttermites'. Tested on Ubuntu 16.04.3 LTS.
###################################################
## Install dependencies for Tracking-Termites! ##
###################################################
# Updates
sudo apt-get update
sudo apt-get upgrade
# Developer tools
sudo apt-get install build-essential cmake pkg-config
# Image I/O libraries
sudo apt-get install libjpeg8-dev libtiff5-dev libjasper-dev libpng12-dev
# Video I/O libraries
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libxvidcore-dev libx264-dev
# GUI tools
sudo apt-get install libgtk-3-dev
# Matrix operation libraries
sudo apt-get install libatlas-base-dev gfortran
# Python development headers
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get install python2.7-dev python3.6-dev
# Download and unzip OpenCV
cd ~
wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.2.0.zip
unzip opencv.zip
# Download and unzip OpenCV-contrib
cd ~
wget -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/3.2.0.zip
unzip opencv_contrib.zip
# Installing pip
cd ~
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
# Installing virtualenvwrapper
sudo pip install virtualenv virtualenvwrapper
sudo rm -rf ~/get-pip.py ~/.cache/pip
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
echo -e "\n# virtualenv and virtualenvwrapper" >> ~/.bashrc
echo "export WORKON_HOME=$HOME/.virtualenvs" >> ~/.bashrc
echo "source /usr/local/bin/virtualenvwrapper.sh" >> ~/.bashrc
source ~/.bashrc
# Creating virtual environment
mkvirtualenv ttermites -p python3.6
workon ttermites
# Install numpy
pip install numpy
# Configure build using cmake
cd ~/opencv-3.2.0/
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D INSTALL_C_EXAMPLES=OFF \
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.2.0/modules \
-D PYTHON_EXECUTABLE=~/../../../usr/bin/python \
-D BUILD_EXAMPLES=ON ..
# OpenCV compilation
sudo make clean
sudo make
# OpenCV installation
sudo make install
sudo ldconfig
# Fix sym-link
cd /usr/local/lib/python3.6/site-packages/
sudo mv cv2.cpython-35m-x86_64-linux-gnu.so cv2.so
cd ~/.virtualenvs/ttermites/lib/python3.6/site-packages/
ln -s /usr/local/lib/python3.6/site-packages/cv2.so cv2.so
# Cloning the repository
sudo apt-get install git
cd ~/Desktop
git clone https://github.com/dmrib/trackingtermites
# Installing dependency packages
cd ~/Desktop/trackingtermites/
pip install -r requirements.txt
# Cleaning
cd ~
sudo rm -r opencv-3.2.0
sudo rm -r opencv_contrib-3.2.0
sudo rm opencv.zip
sudo rm opencv_contrib.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment