下载OpenCV2.4.3按照网上的方法编译,安装到/usr/local/,编译之前先安装一系列跟图像有关的库,如下:
apt-get install ffmpeg libavcodec-dev libavcodec52 libavformat52 libavformat-dev
apt-get install libgstreamer0.10-0-dbg libgstreamer0.10-0 libgstreamer0.10-dev
apt-get install libxine1-ffmpeg libxine-dev libxine1-bin
apt-get install libunicap2 libunicap2-dev
apt-get install libdc1394-22-dev libdc1394-22 libdc1394-utils
apt-get install swig
apt-get install libv4l-0 libv4l-dev
apt-get install python-numpy
apt-get install libpython2.6 python-dev python2.6-dev #You must install this for python support
假如在编译安装之后才安装上面的库,那么出现的情况是:使用OpenCV函数打开摄像头的程序编译无误,但是就是打不开摄像头。