LINUX 下的opencv安装
2008-05-19 21:33
369 查看
1.安装RH9时记得把GTK+安装上,否则,OPENCV里边所有程序是执行不了的。 (包括转贴)
Linux
=====
There are no prebuilt binaries for Linux version (because of different C++-incompatible versions of GCC in different distributions), so you'd have to build it from sources. The following has been tested on Slackware 10.0 (GCC 3.3.*) That's what you need to build fully-functionaly libraries and demos:
======
+GTK+ 2.x or higher.
+ libpng, libjpeg and libtiff with development files.
+ libavcodec from ffmpeg 0.4.8 + headers. Earlier version do not work with OpenCV because of different API. libavcodec is LGPL software, so to use it with non-GPL software (such as OpenCV) you need to build and use a _shared_ library libavcodec.so.*: get ffmpeg-0.4.8 from ffmpeg.sourceforge.net ./configure --enable-shared make make install you will have got: /usr/local/lib/libavcodec.so.* & /usr/local/include/ffmpeg/*.h Now build OpenCV:
======
b) if your distribution does not support RPM, build and install it in Unix/Linux traditional way:
./configure
make
make install # as root
ldconfig # as root
在上面这段中,要确认安装系统时安装了GTK,之后安装ffmpeg(可以在http://download.chinaunix.net/download/0003000/2990.shtml)中下载.
之后的部分参考: http://www.linuxol.cn/Linux-vip/2008-4-19/OPENCV-DeZai-LINUX-XiaDeAnZhuangShiYongZhuYiShiXiang-4ge04.htm
2.记得修改/etc/ld.so.conf
添加一行/usr/local/lib
# ldconfig (root用户)
然后将/usr/local/lib/pkg-config中的opencv.pc 拷贝到/usr/lib/pkg-config中,(如果不做这步,根本编译不起)
可以采用这个操作
# cp /usr/local/lib/pkg-config/opencv.pc /usr/lib/pkg-config
3. congfigure的时候,输入./configure --without-python --enable-static
4.还要注意把OPENCV下的头文件,就是包含cv.h和highgui.h这个2个文件的那个目录里边的所有文件(记得是/usr/local/include/opencv),都拷贝到/usr/include下(别问我为什么,反正不拷贝,编译程序时提示找不到那2个头文件)
5.编译链接文件的方法:
以编辑cvtest.c文件为例子(因为highgui中采用了c++,所以一定要用g++编译才可以)
A. g++ `pkg-config --cflags opencv` -o cvtest cvtest.c `pkg-config --libs opencv`
B. 编译: g++ `pkg-config --cflags opencv` -c cvtest.c
链接: g++ `pkg-config --libs opencv` -o cvtest cvtest.o
注意:g++ 后边那个东西是 ` ,就是ESC下边那个键。
Linux
=====
There are no prebuilt binaries for Linux version (because of different C++-incompatible versions of GCC in different distributions), so you'd have to build it from sources. The following has been tested on Slackware 10.0 (GCC 3.3.*) That's what you need to build fully-functionaly libraries and demos:
======
+GTK+ 2.x or higher.
+ libpng, libjpeg and libtiff with development files.
+ libavcodec from ffmpeg 0.4.8 + headers. Earlier version do not work with OpenCV because of different API. libavcodec is LGPL software, so to use it with non-GPL software (such as OpenCV) you need to build and use a _shared_ library libavcodec.so.*: get ffmpeg-0.4.8 from ffmpeg.sourceforge.net ./configure --enable-shared make make install you will have got: /usr/local/lib/libavcodec.so.* & /usr/local/include/ffmpeg/*.h Now build OpenCV:
======
b) if your distribution does not support RPM, build and install it in Unix/Linux traditional way:
./configure
make
make install # as root
ldconfig # as root
在上面这段中,要确认安装系统时安装了GTK,之后安装ffmpeg(可以在http://download.chinaunix.net/download/0003000/2990.shtml)中下载.
之后的部分参考: http://www.linuxol.cn/Linux-vip/2008-4-19/OPENCV-DeZai-LINUX-XiaDeAnZhuangShiYongZhuYiShiXiang-4ge04.htm
2.记得修改/etc/ld.so.conf
添加一行/usr/local/lib
# ldconfig (root用户)
然后将/usr/local/lib/pkg-config中的opencv.pc 拷贝到/usr/lib/pkg-config中,(如果不做这步,根本编译不起)
可以采用这个操作
# cp /usr/local/lib/pkg-config/opencv.pc /usr/lib/pkg-config
3. congfigure的时候,输入./configure --without-python --enable-static
4.还要注意把OPENCV下的头文件,就是包含cv.h和highgui.h这个2个文件的那个目录里边的所有文件(记得是/usr/local/include/opencv),都拷贝到/usr/include下(别问我为什么,反正不拷贝,编译程序时提示找不到那2个头文件)
5.编译链接文件的方法:
以编辑cvtest.c文件为例子(因为highgui中采用了c++,所以一定要用g++编译才可以)
A. g++ `pkg-config --cflags opencv` -o cvtest cvtest.c `pkg-config --libs opencv`
B. 编译: g++ `pkg-config --cflags opencv` -c cvtest.c
链接: g++ `pkg-config --libs opencv` -o cvtest cvtest.o
注意:g++ 后边那个东西是 ` ,就是ESC下边那个键。
相关文章推荐
- linux opencv支持视频安装
- Linux下安装多版本的Opencv
- linux 下opencv的安装
- ARM-Linux环境下安装OpenCV
- linux安装opencv:ubuntu14.04+opencv3.1.0
- linux下的OpenCV安装&学习笔记
- opencv安装在linux上面
- Linux环境下安装OpenCV
- Linux下: Eclipse安装配置OpenCV2.1,用C++调用OpenCV过程 及 测试实例
- linux下安装支持python2.7的opencv
- 在Linux下安装OpenCV
- linux中安装python科学计算环境-numpy、scipy、matplotlib、OpenCV...
- Linux 下编译安装OpenCV
- Linux 虚拟机 Ubuntu 16.04 安装 OpenCV 3.0
- Linux下Opencv的安装及配置使用
- linux下安装opencv2.3, 遇到的问题汇总
- 基于OpenCv的四轴飞行器寻迹系统(二)——linux下QT的安装及导入OpenCv
- 在linux下安装opencv(参照官网)
- linux下Opencv 2.4.13版本的安装
- OpenCV - Linux中安装使用OpenCV