centos6.7安装opencv-2.4.9
时间:2015-10-16 10:58 来源:linux.it.net.cn 作者:IT
一、整个过程分三步
1. 安装centos基本安装包
2. 安装ffmpeg相关依赖包及ffmpeg
3. 安装opencv
二、具体步骤
1. 安装centos基本安装包
yum install glibc gcc gcc-c++ autoconfautomake libtool git make nasm pkgconfig
yum install SDL-devel a52dec a52dec-develalsa-lib-devel
yum install freetype-devel giflib gsmgsm-devel imlib2 imlib2-devel lame lame-devel libICE-devel libSM-devellibX11-devel
yum install libXau-devel libXdmcp-devellibXext-devel libXrandr-devel libXrender-devel libXt-devel
yum install mesa-libGL-develmesa-libGLU-devel xorg-x11-proto-devel zlib-devel
yum install ncurses-devel
yum install libdc1394 libdc1394-devel
yum install amrnb-devel amrwb-developencore-amr-devel
yum groupinstall "Development tools”
yum install bzip2-devel
yum install openssl-devel
yum install ncurses-devel
yum install sqlite-devel
yum install gtk*
yum install gtk+-devel libjpeg-devel libtiff-devel jasper-devel libpng-devel cmake
yum install git gtk2-devel numpy pythonpython-pip python-devel gstreamer-plugins-base-devel libv4l
yum install cloog-ppl gmp-deve
yum install gimp-devel gimp-devel-toolsgimp-libs gimp libavc1394 libavc1394-devel libdc1394 libdc1394-devel libraw1394libraw1394-devel
2. 安装ffmpeg相关依赖包
yum install xvid4conf xvidcore-develxvidcore libogg libogg-devel liboggz liboggz-deve log4c log4cpluslog4cplus-devel log4cpp libvorbislibvorbis-devel
yum install vorbis-tools libtheora libtheora-devel theora-tools faacfaac-devel faad2 faad2-devel lame twolame-devel twolame flamerobin toolameopus-devel opus libvpx-devel libvpx
yum install libvpx-utils mplayermplayer-gui mplayer-tools mencoder flvtool2.noarch
3. 安装ffmpeg
(1) wget https://www.ffmpeg.org/releases/ffmpeg-2.8.tar.gz
(2) tar zxvf ffmpeg-2.8.tar.gz
(3) cd ffmpeg-2.8
(4) PKG_CONFIG_PATH=/usr/local/ffmpeg_build/lib/pkgconfig
export PKG_CONFIG_PATH
(5)./configure ----prefix="/usr/local/ffmpeg_build"--extra-cflags="-I/usr/local/ffmpeg_build/include"--extra-ldflags="-L/usr/local/ffmpeg_build/lib"--bindir="/usr/local/bin"
--extra-libs=-ldl--enablel-shared --enable-gpl
./configure–prefix=”usr/local/ffmpeg_build” –extra-cflags="-I/usr/local/ffmpeg_build/include"--extra-ldflags="-L/usr/local/ffmpeg_build/lib" --bindir="/usr/local/bin"--extra-libs=-ldl --enablel-shared --enable-gpl
(6) make–j8
(7) makeinstall
(8) cd/etc/bashrc
在最后两行添加
exportPKG_CONFIG_PATH=/usr/local/ffmpeg_build/lib/pkgconfig:$PKG_CONFIG_PATH
exportLD_LIBRARY_PATH=/usr/local/ffmpeg_build/lib:$LD_LIBRARY_PATH
(9)在终端输入ffmpeg
4.安装opencv
(1) unzip opencv-2.4.9.zip
(2) cd opencv-2.4.9.zip
(3) mkdir build
(4) cmake –D CMAKE_BUILD_TYPE=RELEASE–D CMAKE_INSTALL_PREFIX=./build/ ../opencv-2.4.9
(5) make –j8
(6) make install
(7)在终端输入
exportLD_LIBRARY_PATH=/usr/local/opencv-2.4.9/build/lib/:$LD_LIBRARY_PATH
或执行vim /etc/ld.so.conf
在文件最后添加
/usr/local/opencv-2.4.9/lib
在终端输入ldconfig
(8) 执行命令:
cp/usr/local/opencv-2.4.9/lib/pkgconfig/opencv.pc /usr/lib64/pkgconfig/
将/usr/local/opencv-2.4.9/lib/pkgconfig/opencv.pc复制到/usr/lib64/pkgconfig/中
后记:
由于以前开发是在windows上使用opencv,目前因项目需要,开始由windows转到linux服务器上使用Opencv,虽然centos上安装opencv非常简单,却折腾了本人好几天,主要原因是用CvCapture中的相关函数无法获取是否而致,究其因,还是与部分与视频有关的相关安装包没有安装而致,最终少了哪些视频相关安装包,也没有来及探个究竟。以后有时间再具体探究吧。
参考:
1. http://wiki.razuna.com/display/ecp/FFMpeg+Installation+on+CentOS+and+RedHat;
2.https://wuliangx.wordpress.com/2014/11/05/playing-the-video-example-in-oreilly-learning-opencv-with-centos-6-5/;
3. http://wanwentao.blog.51cto.com/2406488/435867;
4. http://blog.csdn.net/guojieaix/article/details/44064213
(责任编辑:IT)
一、整个过程分三步 1. 安装centos基本安装包 2. 安装ffmpeg相关依赖包及ffmpeg 3. 安装opencv 二、具体步骤 1. 安装centos基本安装包 yum install glibc gcc gcc-c++ autoconfautomake libtool git make nasm pkgconfig yum install SDL-devel a52dec a52dec-develalsa-lib-devel yum install freetype-devel giflib gsmgsm-devel imlib2 imlib2-devel lame lame-devel libICE-devel libSM-devellibX11-devel yum install libXau-devel libXdmcp-devellibXext-devel libXrandr-devel libXrender-devel libXt-devel yum install mesa-libGL-develmesa-libGLU-devel xorg-x11-proto-devel zlib-devel yum install ncurses-devel yum install libdc1394 libdc1394-devel yum install amrnb-devel amrwb-developencore-amr-devel yum groupinstall "Development tools” yum install bzip2-devel yum install openssl-devel yum install ncurses-devel yum install sqlite-devel yum install gtk* yum install gtk+-devel libjpeg-devel libtiff-devel jasper-devel libpng-devel cmake yum install git gtk2-devel numpy pythonpython-pip python-devel gstreamer-plugins-base-devel libv4l yum install cloog-ppl gmp-deve yum install gimp-devel gimp-devel-toolsgimp-libs gimp libavc1394 libavc1394-devel libdc1394 libdc1394-devel libraw1394libraw1394-devel 2. 安装ffmpeg相关依赖包 yum install xvid4conf xvidcore-develxvidcore libogg libogg-devel liboggz liboggz-deve log4c log4cpluslog4cplus-devel log4cpp libvorbislibvorbis-devel yum install vorbis-tools libtheora libtheora-devel theora-tools faacfaac-devel faad2 faad2-devel lame twolame-devel twolame flamerobin toolameopus-devel opus libvpx-devel libvpx yum install libvpx-utils mplayermplayer-gui mplayer-tools mencoder flvtool2.noarch 3. 安装ffmpeg (1) wget https://www.ffmpeg.org/releases/ffmpeg-2.8.tar.gz (2) tar zxvf ffmpeg-2.8.tar.gz (3) cd ffmpeg-2.8 (4) PKG_CONFIG_PATH=/usr/local/ffmpeg_build/lib/pkgconfig export PKG_CONFIG_PATH (5)./configure ----prefix="/usr/local/ffmpeg_build"--extra-cflags="-I/usr/local/ffmpeg_build/include"--extra-ldflags="-L/usr/local/ffmpeg_build/lib"--bindir="/usr/local/bin" --extra-libs=-ldl--enablel-shared --enable-gpl ./configure–prefix=”usr/local/ffmpeg_build” –extra-cflags="-I/usr/local/ffmpeg_build/include"--extra-ldflags="-L/usr/local/ffmpeg_build/lib" --bindir="/usr/local/bin"--extra-libs=-ldl --enablel-shared --enable-gpl (6) make–j8 (7) makeinstall (8) cd/etc/bashrc 在最后两行添加 exportPKG_CONFIG_PATH=/usr/local/ffmpeg_build/lib/pkgconfig:$PKG_CONFIG_PATH exportLD_LIBRARY_PATH=/usr/local/ffmpeg_build/lib:$LD_LIBRARY_PATH (9)在终端输入ffmpeg
4.安装opencv (1) unzip opencv-2.4.9.zip (2) cd opencv-2.4.9.zip (3) mkdir build (4) cmake –D CMAKE_BUILD_TYPE=RELEASE–D CMAKE_INSTALL_PREFIX=./build/ ../opencv-2.4.9 (5) make –j8 (6) make install (7)在终端输入 exportLD_LIBRARY_PATH=/usr/local/opencv-2.4.9/build/lib/:$LD_LIBRARY_PATH 或执行vim /etc/ld.so.conf 在文件最后添加 /usr/local/opencv-2.4.9/lib 在终端输入ldconfig (8) 执行命令: cp/usr/local/opencv-2.4.9/lib/pkgconfig/opencv.pc /usr/lib64/pkgconfig/ 将/usr/local/opencv-2.4.9/lib/pkgconfig/opencv.pc复制到/usr/lib64/pkgconfig/中
后记: 由于以前开发是在windows上使用opencv,目前因项目需要,开始由windows转到linux服务器上使用Opencv,虽然centos上安装opencv非常简单,却折腾了本人好几天,主要原因是用CvCapture中的相关函数无法获取是否而致,究其因,还是与部分与视频有关的相关安装包没有安装而致,最终少了哪些视频相关安装包,也没有来及探个究竟。以后有时间再具体探究吧。 参考: 1. http://wiki.razuna.com/display/ecp/FFMpeg+Installation+on+CentOS+and+RedHat; 2.https://wuliangx.wordpress.com/2014/11/05/playing-the-video-example-in-oreilly-learning-opencv-with-centos-6-5/; 3. http://wanwentao.blog.51cto.com/2406488/435867; 4. http://blog.csdn.net/guojieaix/article/details/44064213 (责任编辑:IT) |