Ubuntu OpenCV配置

因为电脑上以及安装有GPU及CUDA驱动,所以与网络已有的安装方法有些区别。

sudo apt-get update

sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy python-tk libtbb-dev libeigen3-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev libqt4-dev libqt4-opengl-dev sphinx-common texlive-latex-extra libv4l-dev libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev default-jdk ant libvtk5-qt4-dev

cd ~
wget http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.9/opencv-2.4.9.zip
unzip opencv-2.4.9.zip
cd opencv-2.4.9

mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CUDA_GENERATION="" -D CMAKE_INSTALL_PREFIX=/usr/local -D CUDA_GENERATION=Kepler ..
make
sudo make install
make -j12

sudo /bin/bash -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig

# add into /etc/bash.bashrc file
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
sudo source /etc/bash.bashrc 

参考

  1. http://yanjiankang.cn/Linux-install-OpenCV-on-Ubuntu-or-Redhat/
  2. http://blog.csdn.net/sysuwuhongpeng/article/details/45542097

你可能感兴趣的:(Ubuntu OpenCV配置)