More than 1 year has passed since last update.
  1. CUDAなどをインストール(JetPack参照)
  2. OpenCVをダウンロード

    wget https://github.com/Itseez/opencv/archive/3.1.0.zip -O /tmp/opencv-3.1.0.zip
    cd /tmp
    unzip opencv-3.1.0.zip
    cd opencv-3.1.0
    git clone --depth 1 https://github.com/Itseez/opencv_contrib.git opencv_contrib
    cd opencv_contrib
    git fetch origin --tags --depth 1
    git checkout 3.1.0
    
  3. 依存パッケージのインストール

    sudo apt-get -y -qq install cmake git libgtk2.0-dev ocl-icd-opencl-dev qt5-default
    
  4. ビルド設定

    mkdir build && cd build
    cmake .. \
    -DWITH_OPENGL:BOOL=ON \
    -DWITH_QT:BOOL=ON \
    -DWITH_CUDA:BOOL=ON \
    -DCUDA_ARCH_BIN="5.2" \
    -DCUDA_ARCH_PTX="5.2" \
    -DCMAKE_BUILD_TYPE=RelWithDebugInfo \
    -DCMAKE_INSTALL_PREFIX=/usr/local \
    -DBUILD_TESTS:BOOL=OFF \
    -DBUILD_PERF_TESTS:BOOL=OFF \
    -DWITH_FFMPEG:BOOL=OFF \
    -DENABLE_NEON:BOOL=ON \
    -DBUILD_EXAMPLES:BOOL=ON \
    -DINSTALL_C_EXAMPLES:BOOL=OFF \
    -DINSTALL_PYTHON_EXAMPLES:BOOL=ON \
    -DOPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules
    
  5. ビルド

    make -j4
    
  6. インストール

    sudo make install -j4
    sudo ldconfig
    
  7. 環境変数を更新

    echo 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
    

テスト

cd opencv-3.1.0/samples/gpu
g++ `pkg-config --libs 
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account log in.