Skip to content

Instantly share code, notes, and snippets.

@ledil
Last active February 22, 2016 21:48
Show Gist options
  • Save ledil/0470da53090e98a88df4 to your computer and use it in GitHub Desktop.
Save ledil/0470da53090e98a88df4 to your computer and use it in GitHub Desktop.
install opencv 3.x ubuntu 14.04 compile prepare packages and on rasbian jessie (raspberry pi)
#!/bin/sh
sudo apt-get update
if which raspi-config >/dev/null; then
sudo apt-get upgrade
fi
sudo apt-get -y install build-essential cmake git pkg-config python-dev
sudo apt-get -y install libjpeg-dev libtiff5-dev libjpeg8-dev libjasper-dev libpng12-dev
sudo apt-get -y install libgtk2.0-dev
sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get -y install libatlas-base-dev gfortran libxvidcore-dev libx264-dev
if which raspi-config >/dev/null; then
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
fi
sudo pip install numpy
git clone https://github.com/Itseez/opencv.git
cd opencv
git checkout 3.1.0
cd ..
git clone https://github.com/Itseez/opencv_contrib.git
cd opencv_contrib
git checkout 3.1.0
cd ..
cd opencv
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D INSTALL_C_EXAMPLES=OFF \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
-D BUILD_EXAMPLES=ON ..
make -j4
sudo make install
sudo ldconfig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment