Skip to content

Instantly share code, notes, and snippets.

@andreanidouglas
Last active January 11, 2017 13:31
Show Gist options
  • Save andreanidouglas/7e7547553382926560191445759878ea to your computer and use it in GitHub Desktop.
Save andreanidouglas/7e7547553382926560191445759878ea to your computer and use it in GitHub Desktop.
Quick guide on how to install and compile opencv 3.2 from its source

Disclaimer This guide has an intent to install the OpenCV libraries for development. Please notice that i'm no Linux expert and this can eventually break your system. Do at your own rist.

General

  • Many packages are required in order to compile the OpenCV libraries.

  • If you have a system with apt-get:

apt-get install gcc-6 libgcc-6-dev
apt-get install ant build-essential python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
apt-get 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
  • After the required packages are installed, make sure that gcc is calling the correct version:
alias gcc=/usr/bin/gcc-6
  • Download the openvc and openvc_contrib sources from GitHub:
git clone https://github.com/Itseez/opencv.git
cd opencv
git clone https://github.com/Itseez/opencv_contrib.git
  • Configure and compile the source: (This will take some time. Relax and grab a beer coffee!)
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
make -j $(nproc)
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment