Skip to content

Instantly share code, notes, and snippets.

@mananpal1997
Created October 17, 2017 15:51
Show Gist options
  • Save mananpal1997/aae71487ebd2a389a695f13860bdc4b1 to your computer and use it in GitHub Desktop.
Save mananpal1997/aae71487ebd2a389a695f13860bdc4b1 to your computer and use it in GitHub Desktop.

Installation Instructions For OpenCV (Linux, Python 3.x)

Run the following commands

  1. Installing required packages (last command is optional, run only if you want to test python version)
$ sudo apt-get install build-essential
$ sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
$ sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
  1. Downloading cmake
$ sudo add-apt-repository ppa:george-edison55/cmake-3.x
$ sudo apt-get update
$ sudo apt-get install cmake
  1. $ cd ~
  2. Downloading opencv and contrib module
$ wget https://github.com/Itseez/opencv/archive/3.1.0.zip
$ wget -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/3.1.0.zip
  1. Install nunpy also - $ (sudo) pip install numpy
  2. Building OpenCV
$ unzip opencv.zip
$ unzip opencv_contrib.zip
$ cd opencv-3.1.0
$ mkdir release
$ cd release
$ cmake -D ENABLE_PRECOMPILED_HEADERS=OFF -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-3.1.0/modules -D BUILD_EXAMPLES=ON -D PYTHON_EXECUTABLE=/usr/bin/python3.5 ..
$ make
$ sudo make install
$ sudo ldconfig

In cmake command, update /usr/local/python3.5 according to your python version.

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