ubuntu14.04行为识别稠密轨迹算法环境配置(OpenCV2.4.2+ffmpeg0.11.1)
这里只说一下环境配置供自己回忆用
先安装依赖包,建议最好是每个包一个一个的进行的安装,这样的话出现问题,容易查找,下面把所需要安装的依赖的包罗列出来(以下包是我总结别人的依赖包进行汇总了一下):
sudo apt-get install make sudo apt-get install automake sudo apt-get install g++
sudo apt-get install bzip2 sudo apt-get install python sudo apt-get install unzip
sudo apt-get install patch sudo apt-get install subversion sudo apt-get install ruby
sudo apt-get install build-essential sudo apt-get install git-core sudo apt-get install checkinstall
sudo apt-get install texi2html sudo apt-get install libfaac-dev sudo apt-get install libmp3lame-dev
sudo apt-get install libopencore-amrwb-dev sudo apt-get install libopencore-amrnb-dev
sudo apt-get install libsdl1.2-dev sudo apt-get install libtheora-dev sudo apt-get install libvdpau-dev
sudo apt-get install libvorbis-dev sudo apt-get install libvpx-dev sudo apt-get install libx11-dev
sudo apt-get install libxfixes-dev sudo apt-get install libxvidcore-dev sudo apt-get install libgtk2.0-dev
sudo apt-get install zlib1g-dev sudo apt-get install libjpeg-dev sudo apt-get install libtiff4-dev
sudo apt-get install libjasper-dev sudo apt-get install libopenexr-dev sudo apt-get install cmake
sudo apt-get install python-dev sudo apt-get install python-numpy sudo apt-get install python-tk
sudo apt-get install libtbb-dev sudo apt-get install libeigen2-dev sudo apt-get install libx264-dev
sudo apt-get install libqt4-dev sudo apt-get install libqt4-opengl-dev sudo apt-get install sphinx-common
sudo apt-get install texlive-latex-extra sudo apt-get install libv4l-dev sudo apt-get install libdc1394-22-dev
sudo apt-get install libavcodec-dev sudo apt-get install libavformat-dev sudo apt-get install libswscale-dev
sudo apt-get install libpng-dev sudo apt-get install libxext-dev
sduo apt-get install yasm
在安装以上依赖包时,会有个别依赖包安装不成功,没关系继续安装其他依赖包,等全部安装结束后再回头将未成功安装的依赖包进行安装,此时发现已然能够安装。
2.安装FFmpeg
先进行卸载已安装成功的FFmpeg,避免冲突
sudo apt-get remove ffmpeg
sudo apt-get autoremove
解压安装包
sudo tar -xvjf ffmpeg-0.11.1.tar.bz2
cd ffmpeg-0.11.1
编译安装
./configure --enable-gpl --enable-nonfree --enable-version3 --enable-shared --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-libvpx --enable-postproc --enable-pthreads --enable-libtheora --enable-x11grab --enable-libvorbis --enable-pic
./configure --enable-gpl --enable-nonfree --enable-version3 --enable-shared --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-libvpx
./configure --enable-gpl --enable-nonfree --enable-version3 --enable-shared --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-libvpx --enable-postproc --enable-pthreads --enable-libtheora --enable-x11grab --enable-libvorbis --enable-pic
make
sudo make install
3.安装OpenCV
sudo tar jxvf OpenCV-2.4.2.tar.bz2 -C /usr/local/
cd /usr/local/
sudo mv OpenCV-2.4.2 opencv
cd opencv
mkdir release
cd release
cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -DINSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -DBUILD_EXAMPLES=ON -D
WITH_QT=ON -D WITH_OPENGL=ON ..
make
sudo make install
安装后的配置
添加库的路径
sudo gedit /etc/ld.so.conf.d/opencv.conf
添加内容
/usr/local/lib
在终端输入命令
sudo ldconfig
设置环境变量
sudo gedit /etc/bash.bashrc
在文件最后加入以下两行并保存:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
此时重启Ubuntu或重新登录账户,使得OpenCV安装生效
测试OpenCV自带例程
编译程序:
cd /usr/local/opencv/samples/c
chmod +x build_all.sh
./build_all.sh
运行程序:
./facedetect –cascade=”/usr/local/share/OpenCV/haarcascades/haarcascade_frontalface_alt.xml” –scale=1.5 lena.jpg
安装结束
参考:
https://blog.csdn.net/xiaocainiaodeboke/article/details/51218821
https://blog.csdn.net/sinat_27318881/article/details/52103896
上一篇: swfupload多图上传限制图片张数