[PYTHON] OpenCV3 installation battle

installation memo of openCV3 + python (2.7)

environment

Preparation

Installation of libraries, etc. that may be necessary for building. It's all apt-get. (Probably some unnecessary things are included)

$ sudo apt-get update
$ sudo apt-get install git cmake python-numpy python-dev libpng12-dev libjpeg-turbo8-dev libtiff5-dev libgtk-3-dev libeigen3-dev libopencv-dev

OpenCV3 Get the sauce. I want to use xfeatures2d but it's in opencv_contrib It will come.

$ git clone https://github.com/Itseez/opencv.git
$ git clone https://github.com/Itseez/opencv_contrib.git

Then run cmake. By specifying it with a flag, opencv_contrib will also be taken care of at once.

$ cd opencv
$ mkdir build
$ cd build
$ cmake -D CMAKE_BUILD_TYPE=RELEASE \
        -D CMAKE_INSTALL_PREFIX=/usr/local \
        -D WITH_EIGEN=ON \
        -D OPENCV_EXTRAMODELUES_PATH="<path/to/opencv_contrib>/modules" \
        ..
$ make
$ sudo make install

Look at the output of cmake to see if the module you want to use and the library can be used properly.

Caution

If you forget to add the library and remake cmake, delete CMakeCache.txt properly.

Recommended Posts

OpenCV3 installation battle
python openCV installation (memo)
OpenCV3 installation for Python3 @macOS
Easy installation of OpenCV on RaspberryPi 3+
OpenCV installation procedure on Raspberry Pi
Django installation
boto3 installation
Pythia Installation
About Opencv ②
Docker installation
Volatility installation
Python installation
About Opencv ③
pip installation
Sphinx installation
InstantOS 1 installation
Jupyter installation
Python installation
pip installation
Kivy installation
ChaSen installation
About Opencv ①
Backtrader installation
pip installation