LoginSignup
4
3

More than 5 years have passed since last update.

OpenCV3 インストールバトル

Posted at

openCV3 + python(2.7) のインストールメモ

環境

  • Ubuntu 14.04 Desktop

準備

ビルドに必要そうなライブラリ等のインストール。
全部apt-getですませちゃう。(おそらく不要なものも含まれているはず)

$ 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

ソースをとってくる。
xfeatures2dを使いたいがそれはopencv_contribにおるので
それもとってくる。

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

つぎにcmakeを走らせる。
フラグで指定することでopencv_contribもまとめて面倒みてくれる。

$ 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

cmakeの出力を見て自分の使いたいモジュールなり、ライブラリなりがちゃんと使えそうかみるとよい。

注意

ライブラリ追加忘れとかでcmakeし直すときはちゃんとCMakeCache.txtを消し去りましょう。

4
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
3