安装opencv2.4.9
首先如果你的运气足够好,你完全可以按照 :
https://my.oschina.net/u/1757926/blog/293976
或者OpenCV中文论坛上的Linux下opencv的安装方法
但是我的运气不好,上述两种方法安装不了,参考这个:链接
我把过程分析如下.
- 由于opencv的cmakelist里依赖一些库,所有要先配置好这些库,我主要是ffmpeg和x264很烦人: 保险起见,先去除你电脑上的这些重新装.
sudo apt-get remove ffmpeg x264 libx264-dev - 安装其他依赖库.
sudo apt-get update
sudo apt-get install build-essential checkinstall Git
cmake libfaac-dev libjack-jackd2-dev libmp3lame-dev
libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev
libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev
libxvidcore-dev texi2html
yasm zlib1g-dev - 安装gstreamer,主要是opencv里头的相机模块用到
sudo apt-get install libgstreamer0.10-0 libgstreamer0.10-dev
gstreamer0.10-tools gstreamer0.10-plugins-base
libgstreamer-plugins-base0.10-dev gstreamer0.10-plugins-good
gstreamer0.10-plugins-ugly gstreamer0.10-plugins-bad
gstreamer0.10-ffmpeg - 安装,接着安装
sudo apt-get install libgtk2.0-0 libgtk2.0-dev sudo apt-get install libjpeg8 libjpeg8-dev- 安装 install x264
- Download a recent stable snapshot of x264 from ftp://ftp.videolan.org/pub/videolan/x264/snapshots/. The exact
version does not seem to matter. To write this guide, I used version
x264-snapshot-20120528-2245-stable.tar.bz2, but I have used previous
versions too.cd ~/srcwget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20120528-2245-stable.tar.bz2
tar xvf x264-snapshot-20120528-2245-stable.tar.bz2
cd x264-snapshot-20120528-2245-stable ./configure--enable-shared --enable-pic
make
sudo make installPS:由于我的电脑是64,所以要加上
,否则就会报错:--enable-shared --enable-pic/usr/bin/ld:
/usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32S
against `av_destruct_packet' can not be used when making a shared
object;
recompile with -fPIC
/usr/local/lib/libavcodec.a: could not read symbols: Bad value
- Download a recent stable snapshot of x264 from ftp://ftp.videolan.org/pub/videolan/x264/snapshots/. The exact
- 安装ffmpeg
- Download ffmpeg version 1.2 from http://ffmpeg.org/download.html.PS:装ffmpeg-0.11.1编译不通过,报错:
- /usr/local/lib/libswscale.a(swscale_unscaled.o):
relocation R_X86_64_32S against `av_pix_fmt_descriptors@@LIBAVUTIL_52'
can not be used when making a shared object; recompile with -fPIC
/usr/local/lib/libswscale.a: error adding symbols: 错误的值
collect2: error: ld returned 1 exit status
make[2]: *** [lib/libopencv_highgui.so.2.4.9] 错误 1
make[1]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/all] 错误 2
make: *** [all] 错误 2猜可能是opencv249依赖的ffmpeg版本不对照
cd ~/src
wget http://ffmpeg.org/releases/ffmpeg-1.2.tar.bz2
tar xvf ffmpeg-1.2.tar.bz2
cd ffmpeg-1.2 ./configure --enable-gpl --enable-libfaac
--enable-libmp3lame --enable-libopencore-amrnb
--enable-libopencore-amrwb --enable-libtheora --enable-libvorbis
--enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc
--enable-version3 --enable-x11grab
--enable-shared --enable-picmake
sudo make install
- 安装v4l (video for linux) from http://www.linuxtv.org/downloads/v4l-utils/.
报错:dvb-v5.h:69:9: error: ‘NULL’ undeclared here ........原因是v4l的版本不对,于是我装了v4l 1.0.0
wget http://www.linuxtv.org/downloads/v4l-utils/v4l-utils-1.0.0.tar.bz2 tar xvf v4l-utils-1.0.0.tar.bz2
cd v4l-utils1.0.0
make
sudo make install- 安装OpenCV 2.4.9.
- Download OpenCV version 2.4.2 from http://sourceforge.net/projects/opencvlibrary/files/
cd ~/srcwget http://downloads.sourceforge.Net/project/opencvlibrary/opencv-unix/2.4.9/OpenCV-2.4.9.tar.bz2
tar xvf OpenCV-2.4.9.tar.bz2 - Create a new build directory and run cmake:
cd OpenCV-2.4.9/
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE .. - 验证指定的输出包括以下内容:
- found gstreamer-base-0.10
- GTK+ 2.x: YES
- FFMPEG: YES
- GStreamer: YES
- V4L/V4L2: Using libv4l
- Build and install OpenCV.
make
sudo make install
- Download OpenCV version 2.4.2 from http://sourceforge.net/projects/opencvlibrary/files/
- Configure 配置 Linux.
- Tell linux where the shared libraries for OpenCV are located by entering the following shell command:[告诉Linux的共享库OpenCV是通过输入下面的shell命令,也就是其库文件存放的位置]:
export LD_LIBRARY_PATH=/usr/local/libAdd the command to your .bashrc file so that you don’t have to enter every time your start a new terminal.该命令添加到你的.bashrc文件,这样你就不需要进入你的每一次开始一个新的终端。
Alternatively, you can configure the system wide library search path.
Using your favorite editor, add a single line containing the text
/usr/local/libto the end of a file named/etc/ld.so.conf.d/opencv.conf.
In the standard Ubuntu install, the opencv.conf file does not exist;
you need to create it. Using vi, for example, enter the following
commands:[或者,您可以配置系统范围的库搜索路径。用你喜欢的编辑器,添加一行文本/usr/local/lib...to the end of a file named/ etc / ld.so.conf.d/opencv.conf。在标准的Ubuntu的安装,opencv.conf文件不存在;你需要创建它。例如,使用VI,输入以下命令:]sudo vi /etc/ld.so.conf.d/opencv.conf
G
o
/usr/local/lib
<Esc>
:wq!After editing the opencv.conf file, enter the following command:
sudo ldconfig /etc/ld.so.conf - Using your favorite editor, add the following two lines to the end of /etc/bash.bashrc:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
- Tell linux where the shared libraries for OpenCV are located by entering the following shell command:[告诉Linux的共享库OpenCV是通过输入下面的shell命令,也就是其库文件存放的位置]:
c.After completing the previous steps, your system should be ready to compile code that uses the OpenCV libraries. The following example shows one way to compile code for OpenCV:
g++ `pkg-config opencv --cflags` my_code.cpp -o my_code `pkg-config opencv --libs`
就这样吧.....最好按照步骤来,先装好依赖库再搞别的...
安装opencv2.4.9的更多相关文章
- Linux Ubuntu12.04下安装OpenCv2.4.10
参考 http://blog.sina.com.cn/s/blog_53b0956801010lfu.html 捣鼓了一个晚上了,OpenCv还没装好,本来以为看个类似的比如Ubuntu安装OpenC ...
- VC 2008 Express下安装OpenCV2.3.1
VC 2008 Express下安装OpenCV2.3.1 注意: 下列文档以VC2008 Express为例,VC2010下的配置应与本文档类似. VC 6.0不被OpenCV 2.3.1支持. ...
- vs2008安装opencv2.4.6
最近安装opencv2.4.6,发现犯了一个很愚蠢的错误,在此记录一下. opencv的头文件包含应该位于build文件夹内,而我误将opencv文件夹下的include包含了进去,造成无法找到头文件 ...
- Ubuntu14.04 64位机上安装OpenCV2.4.13(CUDA8.0)版操作步骤
Ubuntu14.04 64位机上安装CUDA8.0的操作步骤可以参考http://blog.csdn.net/fengbingchun/article/details/53840684,这里是在已经 ...
- CentOS上编译安装OpenCV-2.3.1与ffmpeg-2.1.2
已測试环境: CentOS 6.3 32bit CentOS 6.5 64bit 以前在CentOS 6.3 32bit安装过OpenCV,參见CentOS 6.3中安装OpenCV2.3.1,现在换 ...
- 【opencv安裝】opencv2和opencv3共存——安装opencv2和opencv3到指定目录
安装 opencv2和opencv3共存会导致运行时问题,须分开 下载源码 cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/hom ...
- Ubuntu14.04安装OpenCV2.4.9
1.安装依赖 sudo apt-get install build-essential libgtk2.0-dev libjpeg-dev libtiff4-dev libjasper-dev lib ...
- VC 2010下安装OpenCV2.4.4
说明: 安装平台:32位XP,VS2010: OpenCV 2.4.4不支持VC 6.0: 网上有很多用CMake编译OpenCV的安装教程,这里建议先不要自己编译,如果使用预编译好的库有问题,再尝试 ...
- 转载 VC 2010下安装OpenCV2.4.4
说明: 1.安装平台:32位XP,VS2010: 2.OpenCV 2.4.4不支持VC 6.0: 3.网上有很多用CMake编译OpenCV的安装教程,这里建议先不要自己编译,如果使用预编译好的库有 ...
- (原+转)ubuntu16中安装opencv2.4.11
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5638117.html 参考网址: http://www.cnblogs.com/jeakon/arch ...
随机推荐
- easy.py使用中ValueError: could not convert string to float: svm_options错误问题解决
在使用easy.py中出现如下图所示问题 解决方法: 1.找到cmd = '{0} -svmtrain "{1}" -gnuplot "{2}" "{ ...
- 剑指offer例题——跳台阶、变态跳台阶
题目:一只青蛙一次可以跳上1级台阶,也可以跳上2级.求该青蛙跳上一个n级的台阶总共有多少种跳法(先后次序不同算不同的结果). 思路: n<=0时,有0种跳法 n=1时,只有一种跳法 n=2时,有 ...
- 【381】python 获取列表中重复元素的索引值
参考:获取python的list中含有重复值的index方法_python_脚本之家 核心思想:建立字典,遍历列表,把列表中每个元素和其索引添加到字典里面 cc = [1, 2, 3, 2, 4] f ...
- [ SHELL编程 ] 自动删除操作系统用户
Linux中经常需要删除用户,通常手工操作执行userdel操作即可,如果删除失败出现错误提示按照提示错误进行操作即可.如果是脚本需要调用删除用户操作呢?利用如下实例中drop_user删除用户函数, ...
- Structs复习 ActionMethod
action在执行的是时候 可以不执行excute方法 可以由自己制定 可以在action标签里指定 也可以在方法里动态指定 推荐使用后者 jar包 web.xml <?xml version ...
- 构建缓存gradle
结合Kotlin使用Gradle build cache 宛丘之上兮 关注 2018.03.11 00:21* 字数 1177 阅读 505评论 5喜欢 4 在2017年4月,Gradle发布了bui ...
- ORA-01578 ORACLE data block corrupted (file # 29, block # 2889087)
BW数据库后台报错如下:F:\oracle\SBP\saptrace\diag\rdbms\sbp\sbp\trace ORA-01578: ORACLE data block corrupted ( ...
- metasploit framework(十三):FTP扫描
设置目标IP 查看是否支持匿名登录 获取到版本信息 使用ftp登录模块 搜索刚才获取到的版本信息,找到一个针对这个版本的漏洞利用代码
- SMB扫描
server message block协议,Windows特有的一个协议,实现较复杂,windows应用最广的一个协议,也是安全问题最多的问题,smb协议windows默认开发,用于文件共享. sm ...
- Oracle数据导出导入
总结了几种Oracle导入导出的命令方法,方便以后使用. 数据导出: 1. 将数据库test完全导出,用户名system 密码manager 导出到d:/daochu.dmp中 ...