2015-11-16 13:47:29 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Check OS
|
|
|
|
if [ ! $(command -v apt-get) ]; then
|
|
|
|
echo -e "\e[1;31mERROR: Not a Debian-based linux system.
|
|
|
|
Impossible to install OpenCV with this script\e[0;39m"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
## Before installing
|
|
|
|
echo -e "\e[1;34mUpdating the system\e[0;39m"
|
|
|
|
sudo apt-get update
|
|
|
|
END_CMD1=$?
|
|
|
|
sudo apt-get upgrade -y
|
|
|
|
END_CMD2=$?
|
|
|
|
if [ $END_CMD1 -ne 0 -o $END_CMD2 -ne 0 ]
|
|
|
|
then
|
|
|
|
echo -e "\e[1;31mERROR: \e[39mWhen Updating the system\e[0m"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
## Install Required Requisites
|
|
|
|
echo -e "\e[1;34mInstalling Required Requisites\e[0;39m"
|
|
|
|
sudo apt-get install build-essential \
|
|
|
|
cmake \
|
|
|
|
git \
|
|
|
|
python-pip \
|
|
|
|
pkg-config \
|
|
|
|
libavcodec-dev \
|
|
|
|
libavformat-dev \
|
|
|
|
libswscale-dev -y
|
|
|
|
if [ $? -ne 0 ]
|
|
|
|
then
|
|
|
|
echo -e "\e[1;31mERROR: \e[39mWhen Installing Required Requisites\e[0m"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
## Installing Optional Requisites
|
|
|
|
echo -e "\e[1;34mInstalling Optional Requisites\e[0;39m"
|
|
|
|
sudo apt-get install python-dev \
|
|
|
|
python-numpy \
|
2015-11-23 11:32:05 +00:00
|
|
|
python-pyexiv2 \
|
2015-11-16 13:47:29 +00:00
|
|
|
libtbb2 \
|
|
|
|
libtbb-dev \
|
|
|
|
libjpeg-dev \
|
|
|
|
libpng-dev \
|
|
|
|
libtiff-dev \
|
|
|
|
libjasper-dev \
|
2015-11-20 12:34:34 +00:00
|
|
|
libflann-dev \
|
2015-11-23 11:23:30 +00:00
|
|
|
libproj-dev \
|
2015-11-16 13:47:29 +00:00
|
|
|
libboost-all-dev \
|
|
|
|
libboost-python-dev \
|
|
|
|
libxext-dev \
|
|
|
|
liblapack-dev \
|
|
|
|
libeigen3-dev \
|
|
|
|
libgtk2.0-dev \
|
|
|
|
libvtk5-dev \
|
|
|
|
libgoogle-glog-dev \
|
|
|
|
libsuitesparse-dev -y
|
|
|
|
if [ $? -ne 0 ]
|
|
|
|
then
|
|
|
|
echo -e "\e[1;33mWARNING: \e[39mError when Installing Optional Requisites\e[0m"
|
|
|
|
fi
|
|
|
|
|
2015-11-23 11:23:30 +00:00
|
|
|
## Remove libdc1394-22-dev due to python opencv issue
|
|
|
|
echo -e "\e[1;34mRemoving libdc1394-22-dev\e[0;39m"
|
|
|
|
sudo apt-get remove libdc1394-22-dev
|
|
|
|
|
2015-11-16 13:47:29 +00:00
|
|
|
## Get sys vars
|
|
|
|
NUM_CORES=`grep -c processor /proc/cpuinfo`
|
|
|
|
|
|
|
|
## Compile SuperBuild
|
|
|
|
cd SuperBuild
|
|
|
|
mkdir -p build && cd build
|
2015-11-19 12:00:34 +00:00
|
|
|
cmake .. && make -j ${NUM_CORES}
|