Skip to content

Instantly share code, notes, and snippets.

@andreanidouglas
Last active January 23, 2017 10:24
Show Gist options
  • Save andreanidouglas/ff815dc4702e0b91687bc31976002998 to your computer and use it in GitHub Desktop.
Save andreanidouglas/ff815dc4702e0b91687bc31976002998 to your computer and use it in GitHub Desktop.
######
## Script to automatically compile and install opencv and opencv contrib libraries into debian-like systems
## Created by Douglas Andreani
## Created on: Sep 30th 2015
######
#!/bin/sh
if [ $(id -u) -ne 0 ]; then
echo "Please run as: sudo sh $0"
exit
fi
#update system
apt-get update && apt-get upgrade -y
# install gcc version 6
apt-get install gcc-6 libgcc-6-dev
#set gcc to call to the newest version of gcc
alias gcc=/usr/bin/gcc-6
#install dependencies ---- not check if all requered
apt-get -y install ant build-essential python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
apt-get -y install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
apt-get -y install libopencv-dev build-essential cmake git libgtk2.0-dev pkg-config python-dev python-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libpng12-dev libtiff4-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev libtbb-dev libqt4-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip
apt-get remove libopencv
apt-get remove opencv
#clone the official github repository
git clone https://github.com/Itseez/opencv.git
git clone https://github.com/Itseez/opencv_contrib.git
cd opencv
mkdir release
cd release
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules ../opencv
#compile with 4 concurrent jobs. you may lower or increase this number for better performance
make -j 4
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment