Skip to content

Instantly share code, notes, and snippets.

@jbienkowski311
Last active January 5, 2019 19:11
Show Gist options
  • Save jbienkowski311/658badb7d8c12ff15f28 to your computer and use it in GitHub Desktop.
Save jbienkowski311/658badb7d8c12ff15f28 to your computer and use it in GitHub Desktop.
OpenCV installation script for Debian/Ubuntu
#!/bin/bash
# full update Debian/Ubuntu
sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade && sudo apt-get -y autoremove
# prepare all the compilation tools
sudo apt-get install -y cmake git build-essential wget unzip
# ffmpeg dependencies
sudo apt-get install -y build-essential checkinstall git cmake libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev texi2html yasm zlib1g-dev libsdl1.2-dev libvpx-dev
# gstreamer
sudo apt-get install -y libgstreamer0.10-0 libgstreamer0.10-dev gstreamer0.10-tools gstreamer0.10-plugins-base libgstreamer-plugins-base0.10-dev gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad
# libgtk2
sudo apt-get install -y libgtk2.0-0 libgtk2.0-dev
# libjpeg
sudo apt-get install -y libjpeg-dev
# python
sudo apt-get install -y python-dev python-tk python-numpy python3-dev python3-tk python3-numpy python-qt4 python-pip
# x264
sudo apt-get install -y libx264-dev x264
# video4linux and qt5 for Operator Console
sudo apt-get install -y v4l-utils qt5-default
# create directiory
mkdir ~/source
cd ~/source
# ffmpeg from git repo
git clone https://github.com/FFmpeg/FFmpeg.git
cd FFmpeg/
# compilation
./configure --enable-gpl --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-shared --enable-libvpx --enable-pic
make
sudo make install
sudo ldconfig -v
# opencv compilation
cd ..
wget https://github.com/Itseez/opencv/archive/2.4.11.zip
unzip 2.4.11.zip
cd opencv-2.4.11/
mkdir build/
cd build/
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..
make -j $(nproc)
sudo make install
sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig -v
# back to the home directory
cd ~
# install screen
sudo apt-get install -y screen
@pglimos
Copy link

pglimos commented May 12, 2015

sudo apt-get install -y screen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment