1. 程式人生 > >Ubuntu16.04編譯opencv3.1 CUDA9.0

Ubuntu16.04編譯opencv3.1 CUDA9.0

2.修改cmake資料夾中的FindCUDA.cmake檔案;

(1)查詢“unset(CUDA_nppi_LIBRARY CACHE)”;

替換為:

  unset(CUDA_nppial_LIBRARY CACHE)
  unset(CUDA_nppicc_LIBRARY CACHE)
  unset(CUDA_nppicom_LIBRARY CACHE)
  unset(CUDA_nppidei_LIBRARY CACHE)
  unset(CUDA_nppif_LIBRARY CACHE)
  unset(CUDA_nppig_LIBRARY CACHE)
  unset(CUDA_nppim_LIBRARY CACHE)
  unset(CUDA_nppist_LIBRARY CACHE)
  unset(CUDA_nppisu_LIBRARY CACHE)
  unset(CUDA_nppitc_LIBRARY CACHE)

(2)查詢"find_cuda_helper_libs(nppi)";

替換為:

  find_cuda_helper_libs(nppial)
  find_cuda_helper_libs(nppicc)
  find_cuda_helper_libs(nppicom)
  find_cuda_helper_libs(nppidei)
  find_cuda_helper_libs(nppif)
  find_cuda_helper_libs(nppig)
  find_cuda_helper_libs(nppim)
  find_cuda_helper_libs(nppist)
  find_cuda_helper_libs(nppisu)
  find_cuda_helper_libs(nppitc)

3.安裝cmake工具;

sudo apt-get install cmake

4.安裝依賴庫;

sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg.dev libtiff4.dev libswscale-dev libjasper-dev

5.解壓下載的opencv3.1.0原始碼,進入到opencv3.1.0資料夾,建立release資料夾並進入;

mkdir release && cd release

6.cmake配置編譯 ;

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON  -D CUDA_GENERATION=Kepler -D BUILD_PNG=ON ..

7.make編譯和安裝;

make -j$(nproc)
sudo make install

8.安裝完成!