linux安装opencv2.4

(1)配置opencv的编译执行环境

sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg62-dev libtiff4-dev cmake libswscale-dev libjasper-dev
sudo apt-get install build-essential
sudo apt-get install cmake
sudo apt-get install pkg-config
sudo apt-get install libpng12-0 libpng12-dev libpng++-dev libpng3
sudo apt-get install libpnglite-dev libpngwriter0-dev libpngwriter0c2
sudo apt-get install zlib1g-dbg zlib1g zlib1g-dev
sudo apt-get install libjasper-dev libjasper-runtime libjasper1
sudo apt-get install pngtools libtiff4-dev libtiff4 libtiffxx0c2 libtiff-tools
sudo apt-get install libjpeg8 libjpeg8-dev libjpeg8-dbg libjpeg-prog
sudo apt-get install ffmpeg libavcodec-dev libavcodec52 libavformat52 libavformat-dev
sudo apt-get install libgstreamer0.10-0-dbg libgstreamer0.10-0  libgstreamer0.10-dev
sudo apt-get install libxine1-ffmpeg  libxine-dev libxine1-bin
sudo apt-get install libunicap2 libunicap2-dev
sudo apt-get install libdc1394-22-dev libdc1394-22 libdc1394-utils
sudo apt-get install swig
sudo apt-get install libv4l-0 libv4l-dev

sudo apt-get install python-numpy

(2)解压opencv源码,make,make install 中间过程默认就行

(3)设置环境变量,不执行这一步在运行例程及其他OpenCV程序时就会出现错误:
  运行sudo gedit/etc/ld.so.conf.d/opencv.conf,在打开的文件中添加/usr/local/lib,保存并关闭。
  运行sudoldconfig
      sudo gedit /etc/bash.bashrc
  在打开的文件最后加入以下两行:

     PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
      export PKG_CONFIG_PATH

lias gcv="g++ `pkg-config --cflags opencv` `pkg-config --libs opencv`"


你可能感兴趣的:(c,linux,Path)