1. 先从sourceforge上下载OpenCV的源码
http://sourceforge.net/projects/opencvlibrary/files/opencv-unix/2.4.0/
2. 解压到任意目录
tar xvfj OpenCV-2.4.3.tar.bz2
3. 进入源码目录,创建release目录
cd OpenCV-2.4.3
mkdir release
4. 可以看到在OpenCV目录下,有个CMakeLists.txt文件,需要事先安装一些软件
sudo apt-get install build-essential cmake libgtk2.0-dev pkg-config python-dev python-numpy libavcodec-dev libavformat-dev libswscale-dev
5. 进入release目录,安装OpenCV是所有的文件都会被放到这个release目录下
cd release
6. cmake编译OpenCV源码,安装所有的lib文件都会被安装到/usr/local目录下