OpenCV 3.0に果敢に挑戦し続けてみる

個人的な趣味の一環として、OpenCV 3.0がらみの情報をまとめてみる。「引用はいぃんよー、無断転載はあかんよー」ということで。

OpenCV 2.4.8 for Raspberry Pi

OpenCV 2.4.8 for Raspberry Pi

できるだけ待ち時間を短くできるように、色々調整してみる。

予め必要なライブラリをインストール

OpenCVはいくつかの3rd partyなライブラリを含んでいるので、コンパイルせずにapt-get installで入れておく。

$ sudo apt-get update
$ sudo apt-get install cmake 
$ sudo apt-get install libgtk2.0-dev
$ sudo apt-get install libtiff5-dev
$ sudo apt-get install libjasper-dev

ソースコードをダウンロード ( http://opencv.org/ )

$ wget "http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.8/opencv-2.4.8.zip"
$ unzip opencv-2.4.8.zip

Makefileを作ってコンパイル

サンプルとかテストとかなくてもいいよね?ドキュメントも作られない事を確認済み。

$ cd opencv-2.4.8 ; mkdir build ; cd build ;

$ cmake  -D BUILD_EXAMPLES=OFF -D BUILD_PERF_TESTS=OFF -D BUILD_TESTS=OFF ..

 コンパイルしてインストールする

$ time make

 

二時間ちょっとで終わりました。

[100%] Built target opencv_traincascade

 

real    137m58.904s

user    126m22.630s

sys     2m33.940s

 

 

 

生成された設定は以下の通り(参考)

 --

-- General configuration for OpenCV 2.4.8 =====================================

--   Version control:               unknown

--

--   Platform:

--     Host:                        Linux 3.6.11+ armv6l

--     CMake:                       2.8.9

--     CMake generator:             Unix Makefiles

--     CMake build tool:            /usr/bin/make

--     Configuration:               Release

--

--   C/C++:

--     Built as dynamic libs?:      YES

--     C++ Compiler:                /usr/bin/c++  (ver 4.6.3)

--     C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -O3 -DNDEBUG  -DNDEBUG

--     C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG

--     C Compiler:                  /usr/bin/gcc

--     C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -O3 -DNDEBUG  -DNDEBUG

--     C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -g  -O0 -DDEBUG -D_DEBUG

--     Linker flags (Release):

--     Linker flags (Debug):

--     Precompiled headers:         YES

--

--   OpenCV modules:

--     To be built:                 core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu ocl nonfree contrib python stitching superres ts videostab

--     Disabled:                    world

--     Disabled by dependency:      -

--     Unavailable:                 androidcamera dynamicuda java

--

--   GUI:

--     QT:                          NO

--     GTK+ 2.x:                    YES (ver 2.24.10)

--     GThread :                    YES (ver 2.32.4)

--     GtkGlExt:                    NO

--     OpenGL support:              NO

--

--   Media I/O:

--     ZLib:                        /usr/lib/arm-linux-gnueabihf/libz.so (ver 1.2.7)

--     JPEG:                        /usr/lib/arm-linux-gnueabihf/libjpeg.so (ver 80)

--     PNG:                         /usr/lib/arm-linux-gnueabihf/libpng.so (ver 1.2.49)

--     TIFF:                        /usr/lib/arm-linux-gnueabihf/libtiff.so (ver 42 - 4.0.2)

--     JPEG 2000:                   /usr/lib/arm-linux-gnueabihf/libjasper.so (ver 1.900.1)

--     OpenEXR:                     /usr/lib/libImath.so /usr/lib/libIlmImf.so /usr/lib/libIex.so /usr/lib/libHalf.so /usr/lib/libIlmThread.so (ver 1.6.1)

--

--   Video I/O:

--     DC1394 1.x:                  NO

--     DC1394 2.x:                  NO

--     FFMPEG:                      NO

--       codec:                     NO

--       format:                    NO

--       util:                      NO

--       swscale:                   NO

--       gentoo-style:              NO

--     GStreamer:

--       base:                      YES (ver 0.10.36)

--       app:                       YES (ver 0.10.36)

--       video:                     YES (ver 0.10.36)

--     OpenNI:                      NO

--     OpenNI PrimeSensor Modules:  NO

--     PvAPI:                       NO

--     GigEVisionSDK:               NO

--     UniCap:                      NO

--     UniCap ucil:                 NO

--     V4L/V4L2:                    NO/YES

--     XIMEA:                       NO

--     Xine:                        NO

--

--   Other third-party libraries:

--     Use IPP:                     NO

--     Use Eigen:                   NO

--     Use TBB:                     NO

--     Use OpenMP:                  NO

--     Use GCD                      NO

--     Use Concurrency              NO

--     Use C=:                      NO

--     Use Cuda:                    NO

--     Use OpenCL:                  YES

--

--   OpenCL:

--     Version:                     dynamic

--     Include path:                /home/pi/opencv/opencv-2.4.8/3rdparty/include/opencl/1.2

--     Use AMD FFT:                 NO

--     Use AMD BLAS:                NO

--

--   Python:

--     Interpreter:                 /usr/bin/python2 (ver 2.7.3)

--     Libraries:                   /usr/lib/libpython2.7.so (ver 2.7.3)

--     numpy:                       /usr/lib/pymodules/python2.7/numpy/core/include (ver 1.6.2)

--     packages path:               lib/python2.7/dist-packages

--

--   Java:

--     ant:                         NO

--     JNI:                         NO

--     Java tests:                  NO

--

--   Documentation:

--     Build Documentation:         NO

--     Sphinx:                      NO

--     PdfLaTeX compiler:           NO

--

--   Tests and samples:

--     Tests:                       NO

--     Performance tests:           NO

--     C/C++ Examples:              NO

--

--   Install path:                  /usr/local

--

--   cvconfig.h is in:              /home/pi/opencv/opencv-2.4.8/build

-- -----------------------------------------------------------------

--

-- Configuring done

-- Generating done

-- Build files have been written to: /home/pi/opencv/opencv-2.4.8/build