概要

  • OpenCV 3.1.0 がリリースされたのでJetson TK1上にインストールしてみた

前提準備

今回のターゲット

  • Jetson TK1
  • L4T (Ubuntu 14.04をベースにしたもの)
  • Arm A15 w/ neon
  • Tegra K1 (192 core)

OpenCV の取得

  • まずはgitでcloneする
  • code.opencv.org がgitのhostingをやめてしまったので、githubからcloneする
    ubuntu@tegra-ubuntu:~$ time git clone git@github.com:Itseez/opencv.git
    Cloning into 'opencv'...
    remote: Counting objects: 185816, done.
    remote: Compressing objects: 100% (21/21), done.
    Receiving objects:   0% (1/185816)
    
    remote: Total 185816 (delta 9), reused 7 (delta 7), pack-reused 185788
    Receiving objects: 100% (185816/185816), 408.17 MiB | 1.66 MiB/s, done.
    Resolving deltas: 100% (127433/127433), done.
    Checking connectivity... done.
    Checking out files: 100% (4654/4654), done.
    
    real    2m52.930s
    user    1m9.561s
    sys     0m21.632s
  • そして、3.1.0をチェックアウトする
    ubuntu@tegra-ubuntu:~$ cd opencv
    ubuntu@tegra-ubuntu:~/opencv$ git checkout -b Branch_3_1_0 3.1.0
    Switched to a new branch 'Branch_3_1_0'

OpenCV3.1.0のビルド

cmake

  • ODROID-X2でOpenCV 3.1.0をビルド同様、out of source buildする
    ubuntu@tegra-ubuntu:~/opencv$ mkdir build
    ubuntu@tegra-ubuntu:~/opencv$ cd build/
    ubuntu@tegra-ubuntu:~/opencv/build$ time cmake -DBUILD_EXAMPLES:BOOL=ON -DENABLE_NEON:BOOL=ON -DCUDA_ARCH_BIN=3.2 -DCUDA_ARCH_PTX= ../
    (中略)
    
    real    0m54.217s
    user    0m42.775s
    sys     0m7.760s

make all

  • Armの4coreをフルに使う
    ubuntu@tegra-ubuntu:~/opencv/build$ time make -j4 all
    (中略)
    
    real    49m18.453s
    user    173m36.759s
    sys     9m45.257s
  • make -j all だけやると、gcc internal error とかが出たので、-j4 にする
  • ざっくり49分ぐらいかかる

make install

  • installにはsudoをつける
    ubuntu@tegra-ubuntu:~/opencv/build$ time sudo make install
    (中略)
    
    real    3m9.933s
    user    2m16.229s
    sys     0m28.954s
  • /usr/local/include 以下に header が、
  • /usr/local/lib 以下に .so ファイルが、
  • /usr/local/share/OpenCV 以下に Haar特徴量のcascade classifierが
  • それぞれインストールされる

OpenCVビルド時のコンフィグなど

cvconfig.h

/* OpenCV compiled as static or dynamic libs */
#define BUILD_SHARED_LIBS

/* Compile for 'real' NVIDIA GPU architectures */
#define CUDA_ARCH_BIN " 32"

/* Create PTX or BIN for 1.0 compute capability */
/* #undef CUDA_ARCH_BIN_OR_PTX_10 */

/* NVIDIA GPU features are used */
#define CUDA_ARCH_FEATURES " 32"

/* Compile for 'virtual' NVIDIA PTX architectures */
#define CUDA_ARCH_PTX ""

/* AVFoundation video libraries */
/* #undef HAVE_AVFOUNDATION */

/* V4L capturing support */
/* #undef HAVE_CAMV4L */

/* V4L2 capturing support */
#define HAVE_CAMV4L2

/* Carbon windowing environment */
/* #undef HAVE_CARBON */

/* AMD's Basic Linear Algebra Subprograms Library*/
/* #undef HAVE_CLAMDBLAS */

/* AMD's OpenCL Fast Fourier Transform Library*/
/* #undef HAVE_CLAMDFFT */

/* Clp support */
/* #undef HAVE_CLP */

/* Cocoa API */
/* #undef HAVE_COCOA */

/* C= */
/* #undef HAVE_CSTRIPES */

/* NVidia Cuda Basic Linear Algebra Subprograms (BLAS) API*/
/* #undef HAVE_CUBLAS */

/* NVidia Cuda Runtime API*/
#define HAVE_CUDA

/* NVidia Cuda Fast Fourier Transform (FFT) API*/
#define HAVE_CUFFT

/* IEEE1394 capturing support */
/* #undef HAVE_DC1394 */

/* IEEE1394 capturing support - libdc1394 v2.x */
/* #undef HAVE_DC1394_2 */

/* DirectX */
/* #undef HAVE_DIRECTX */
/* #undef HAVE_DIRECTX_NV12 */
/* #undef HAVE_D3D11 */
/* #undef HAVE_D3D10 */
/* #undef HAVE_D3D9 */

/* DirectShow Video Capture library */
/* #undef HAVE_DSHOW */

/* Eigen Matrix & Linear Algebra Library */
/* #undef HAVE_EIGEN */

/* FFMpeg video library */
/* #undef HAVE_FFMPEG */

/* ffmpeg's libswscale */
/* #undef HAVE_FFMPEG_SWSCALE */

/* ffmpeg in Gentoo */
/* #undef HAVE_GENTOO_FFMPEG */

/* Geospatial Data Abstraction Library */
/* #undef HAVE_GDAL */

/* GStreamer multimedia framework */
/* #undef HAVE_GSTREAMER */

/* GTK+ 2.0 Thread support */
#define HAVE_GTHREAD

/* GTK+ 2.x toolkit */
#define HAVE_GTK

/* Define to 1 if you have the <inttypes.h> header file. */
/* #undef HAVE_INTTYPES_H */

/* Intel Perceptual Computing SDK library */
/* #undef HAVE_INTELPERC */

/* Intel Integrated Performance Primitives */
/* #undef HAVE_IPP */
/* #undef HAVE_IPP_ICV_ONLY */

/* Intel IPP Async */
/* #undef HAVE_IPP_A */

/* JPEG-2000 codec */
#define HAVE_JASPER

/* IJG JPEG codec */
#define HAVE_JPEG

/* libpng/png.h needs to be included */
#define HAVE_LIBPNG_PNG_H

/* V4L/V4L2 capturing support via libv4l */
/* #undef HAVE_LIBV4L */

/* Microsoft Media Foundation Capture library */
/* #undef HAVE_MSMF */

/* NVidia Video Decoding API*/
/* #undef HAVE_NVCUVID */

/* OpenCL Support */
#define HAVE_OPENCL
/* #undef HAVE_OPENCL_STATIC */
/* #undef HAVE_OPENCL_SVM */

/* OpenEXR codec */
#define HAVE_OPENEXR

/* OpenGL support*/
/* #undef HAVE_OPENGL */

/* OpenNI library */
/* #undef HAVE_OPENNI */

/* OpenNI library */
/* #undef HAVE_OPENNI2 */

/* PNG codec */
#define HAVE_PNG

/* Posix threads (pthreads) */
#define HAVE_PTHREADS

/* parallel_for with pthreads */
#define HAVE_PTHREADS_PF

/* Qt support */
/* #undef HAVE_QT */

/* Qt OpenGL support */
/* #undef HAVE_QT_OPENGL */

/* QuickTime video libraries */
/* #undef HAVE_QUICKTIME */

/* QTKit video libraries */
/* #undef HAVE_QTKIT */

/* Intel Threading Building Blocks */
/* #undef HAVE_TBB */

/* TIFF codec */
#define HAVE_TIFF

/* Unicap video capture library */
/* #undef HAVE_UNICAP */

/* Video for Windows support */
/* #undef HAVE_VFW */

/* V4L2 capturing support in videoio.h */
/* #undef HAVE_VIDEOIO */

/* Win32 UI */
/* #undef HAVE_WIN32UI */

/* XIMEA camera support */
/* #undef HAVE_XIMEA */

/* Xine video library */
/* #undef HAVE_XINE */

/* Define if your processor stores words with the most significant byte
   first (like Motorola and SPARC, unlike Intel and VAX). */
/* #undef WORDS_BIGENDIAN */

/* gPhoto2 library */
/* #undef HAVE_GPHOTO2 */

/* VA library (libva) */
/* #undef HAVE_VA */

/* Intel VA-API/OpenCL */
/* #undef HAVE_VA_INTEL */

version_string.inc

General configuration for OpenCV 3.1.0 =====================================
  Version control:               3.1.0

  Platform:
    Host:                        Linux 3.10.40-grinch-21.3.4 armv7l
    CMake:                       2.8.12.2
    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.8.4)
    C++ flags (Release):         -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -mfpu=neon -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG  -DNDEBUG
    C++ flags (Debug):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -fdiagnostics-show-option -pthread -fomit-frame-pointer -mfpu=neon -ffunction-sections -fvisibility=hidden -fvisibility-inlines-hidden -g  -O0 -DDEBUG -D_DEBUG
    C Compiler:                  /usr/bin/cc
    C flags (Release):           -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -pthread -fomit-frame-pointer -mfpu=neon -ffunction-sections -fvisibility=hidden -O3 -DNDEBUG  -DNDEBUG
    C flags (Debug):             -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -fdiagnostics-show-option -pthread -fomit-frame-pointer -mfpu=neon -ffunction-sections -fvisibility=hidden -g  -O0 -DDEBUG -D_DEBUG
    Linker flags (Release):      
    Linker flags (Debug):        
    Precompiled headers:         YES
    Extra dependencies:          /usr/lib/arm-linux-gnueabihf/libpng.so /usr/lib/arm-linux-gnueabihf/libz.so gtk-x11-2.0 gdk-x11-2.0 atk-1.0 gio-2.0 pangoft2-1.0 pangocairo-1.0 gdk_pixbuf-2.0 cairo pango-1.0 fontconfig gobject-2.0 freetype gthread-2.0 glib-2.0 dl m pthread rt cudart nppc nppi npps cufft -L/usr/local/cuda/lib
    3rdparty dependencies:       libjpeg libwebp libtiff libjasper IlmImf

  OpenCV modules:
    To be built:                 cudev core cudaarithm flann imgproc ml video cudabgsegm cudafilters cudaimgproc cudawarping imgcodecs photo shape videoio cudacodec highgui objdetect ts features2d calib3d cudafeatures2d cudalegacy cudaobjdetect cudaoptflow cudastereo stitching superres videostab
    Disabled:                    world
    Disabled by dependency:      -
    Unavailable:                 java python2 python3 viz

  GUI: 
    QT:                          NO
    GTK+ 2.x:                    YES (ver 2.24.23)
    GThread :                    YES (ver 2.40.2)
    GtkGlExt:                    NO
    OpenGL support:              NO
    VTK support:                 NO

  Media I/O: 
    ZLib:                        /usr/lib/arm-linux-gnueabihf/libz.so (ver 1.2.8)
    JPEG:                        libjpeg (ver 90)
    WEBP:                        build (ver 0.3.1)
    PNG:                         /usr/lib/arm-linux-gnueabihf/libpng.so (ver 1.2.50)
    TIFF:                        build (ver 42 - 4.0.2)
    JPEG 2000:                   build (ver 1.900.1)
    OpenEXR:                     build (ver 1.7.1)
    GDAL:                        NO

  Video I/O:
    DC1394 1.x:                  NO
    DC1394 2.x:                  NO
    FFMPEG:                      NO
      codec:                     NO
      format:                    NO
      util:                      NO
      swscale:                   NO
      resample:                  NO
      gentoo-style:              NO
    GStreamer:                   NO
    OpenNI:                      NO
    OpenNI PrimeSensor Modules:  NO
    OpenNI2:                     NO
    PvAPI:                       NO
    GigEVisionSDK:               NO
    UniCap:                      NO
    UniCap ucil:                 NO
    V4L/V4L2:                    NO/YES
    XIMEA:                       NO
    Xine:                        NO
    gPhoto2:                     NO

  Parallel framework:            pthreads

  Other third-party libraries:
    Use IPP:                     NO
    Use VA:                      NO
    Use Intel VA-API/OpenCL:     NO
    Use Eigen:                   NO
    Use Cuda:                    YES (ver 6.5)
    Use OpenCL:                  YES
    Use custom HAL:              NO

  NVIDIA CUDA
    Use CUFFT:                   YES
    Use CUBLAS:                  NO
    USE NVCUVID:                 NO
    NVIDIA GPU arch:             32
    NVIDIA PTX archs:
    Use fast math:               NO

  OpenCL:
    Version:                     dynamic
    Include path:                /home/ubuntu/opencv/3rdparty/include/opencl/1.2
    Use AMDFFT:                  NO
    Use AMDBLAS:                 NO

  Python 2:
    Interpreter:                 /usr/bin/python2.7 (ver 2.7.6)

  Python 3:
    Interpreter:                 /usr/bin/python3.4 (ver 3.4.3)

  Python (for build):            /usr/bin/python2.7

  Java:
    ant:                         NO
    JNI:                         NO
    Java wrappers:               NO
    Java tests:                  NO

  Matlab:                        Matlab not found or implicitly disabled

  Documentation:
    Doxygen:                     NO
    PlantUML:                    NO

  Tests and samples:
    Tests:                       YES
    Performance tests:           YES
    C/C++ Examples:              YES

  Install path:                  /usr/local

  cvconfig.h is in:              /home/ubuntu/opencv/build
-----------------------------------------------------------------

ビルドされたライブラリや実行ファイル

     7424 Feb 17 20:30 libopencv_cudev.so.3.1.0
  3560158 Feb 17 20:36 libopencv_core.so.3.1.0
   344705 Feb 17 20:36 libopencv_flann.so.3.1.0
   554406 Feb 17 20:37 libopencv_ml.so.3.1.0
  2517135 Feb 17 20:40 libopencv_imgproc.so.3.1.0
  2271061 Feb 17 20:41 libopencv_imgcodecs.so.3.1.0
   316514 Feb 17 20:41 libopencv_video.so.3.1.0
   187170 Feb 17 20:43 libopencv_shape.so.3.1.0
   117250 Feb 17 20:43 libopencv_videoio.so.3.1.0
  7355080 Feb 17 20:44 libopencv_cudawarping.so.3.1.0
    52997 Feb 17 20:44 libopencv_highgui.so.3.1.0
   178592 Feb 17 20:44 libopencv_cudabgsegm.so.3.1.0
    36812 Feb 17 20:44 libopencv_cudacodec.so.3.1.0
   342438 Feb 17 20:45 libopencv_objdetect.so.3.1.0
  1366746 Feb 17 20:45 libopencv_ts.a
   610750 Feb 17 20:46 libopencv_features2d.so.3.1.0
 23596740 Feb 17 20:48 libopencv_cudaarithm.so.3.1.0
  1032478 Feb 17 21:03 libopencv_calib3d.so.3.1.0
 41072760 Feb 17 21:06 libopencv_cudafilters.so.3.1.0
  1261423 Feb 17 21:07 libopencv_cudastereo.so.3.1.0
  3550793 Feb 17 21:09 libopencv_cudafeatures2d.so.3.1.0
  4735578 Feb 17 21:10 libopencv_cudaimgproc.so.3.1.0
   841403 Feb 17 21:12 libopencv_photo.so.3.1.0
  1205022 Feb 17 21:13 libopencv_cudalegacy.so.3.1.0
   256863 Feb 17 21:13 libopencv_cudaobjdetect.so.3.1.0
  1083089 Feb 17 21:14 libopencv_cudaoptflow.so.3.1.0
   467799 Feb 17 21:14 libopencv_stitching.so.3.1.0
   276608 Feb 17 21:14 libopencv_superres.so.3.1.0
   457631 Feb 17 21:15 libopencv_videostab.so.3.1.0

performance

  • TBW

関連ページ


*1  💻 CUDA GPUS | NVIDIA Developer, 2016-02-18閲覧

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2017-08-24 (木) 10:01:12 (115d)