Ubuntu 14.04安装OpenCV2.4.9

Ubuntu 14.04安装OpenCV2.4.9

安装工具

sudo apt-get install git
sudo apt-get install g++
sudo apt-get install vim

下载Opencv

opencv2.9

解压

mkdir tmp
mv opencv-2.4.9.zip tmp
cd tmp
unzip opencv-2.4.9.zip
cd opencv-2.4.9
mkdir release

安装依赖库

sudo apt-get install build-essential cmake libgtk2.0-dev pkg-config python-dev python-numpy libavcodec-dev libavformat-dev libswscale-dev

在opencv的官方文档也有说明:

  1. GCC 4.4.x or later. This can be installed with:sudo apt-get install build-essential <br>
  2. CMake 2.6 or higher;
  3. Git;
  4. GTK+2.x or higher, including headers (libgtk2.0-dev);
  5. pkg-config;
  6. Python 2.6 or later and Numpy 1.5 or later with developer packages (python-dev, python-numpy);
  7. ffmpeg or libav development packages: libavcodec-dev, libavformat-dev, libswscale-dev;
  8. [optional] libdc1394 2.x;
  9. [optional] libjpeg-dev, libpng-dev, libtiff-dev, libjasper-dev.
    ff-dev, libjasper-dev.

进入目录生成MakeFile文件

cd releaase

安装所有的lib文件都会被安装到/usr/local目录下

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..

Ubuntu 14.04安装OpenCV2.4.9

构建和安装

make

Ubuntu 14.04安装OpenCV2.4.9

make install

Ubuntu 14.04安装OpenCV2.4.9

加载动态连接库

OpenCV的详细介绍:请点这里
OpenCV的下载地址:请点这里

相关推荐