(注意安装之前要安装g++,gcc)
Step 1:安装必要的依赖包
sudo apt-get install build-essential libgtk2.0-dev libjpeg62-dev libtiff4-dev libjasper-dev libopenexr-dev cmake python-dev python-numpy libtbb-dev libeigen2-dev yasm libfaac-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev
此处可能出现一个包依赖的错误。可以参照
解决包依赖关系
Step 2:安装ffmpeg1
1:cd ~ //进入用户主目录(即 :home/你的计算机名/)
2:下载ffmpeg1.0 地址:http://download.csdn.net/detail/speedme/4847324
3:将其复制到 “ home/你的计算机名/”下;同样将先下载好的ffmpeg包放在主目录下
4:cd ffmpeg1.0
5:
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libxvid --enable-x11grab --enable-swscale --enable-shared
6: make
7:sudo make install
Step 3:安装OpenCV 2.4.2
1:下载地址:http://download.csdn.net/detail/speedme/4847323
2: tar -xvf OpenCV-2.4.2.tar.bz2
3:将其复制到 “ home/你的计算机名/”下;
4:cd OpenCV-2.4.2
5:mkdir release
6:cd release
7:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_TBB=ON -D WITH_V4L=OFF -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON ..
8:
make
9:sudo make install
Step 4:添加库的路径
1: sudo gedit /etc/ld.so.conf.d/opencv.conf //此时虚拟终端的路径为:用户主目录 加入:/usr/local/lib 然后保存
2:sudo ldconfig
3: sudo gedit /etc/environment 加入如下内容
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
所有配置已经完成。