版本:ubuntu9.04 gcc 4.4.1
opencv2.0
目的:在PC机的linux系统上运行一个虹膜识别的程序,没有窗口。
参考文档:http://opencv.willowgarage.com/wiki/InstallGuide%20%3A%20Debian,http://blog.csdn.net/ranruoyu1003/article/details/6098847
先安装必要的包(不必安装上面文档全部提到的包)命令如下:
apt-get install build-essential
apt-get install zlib1g-dbg zlib1g zlib1g-dev
apt-get install libpng12-dev
apt-get install libjasper-dev
上面安装的这三个库必须要,否刚Opencv装不能运行成功(至少对我来说是这样的,开始就是没装这三个库总是出错,后来装了就好使了)。在安装这三个库的过程中可能会出现一些版本不符合的情况,这可以用新立得->包管理->强制,强制安装某一个版本。
接下来就是解压编译,confiugre的参数如下:
./configure --without-gtk --without-carbon --without-quicktime--without-1394libs --without-ffmpeg --without-python --without-swig--enable-shared --prefix=/opt/x86/opencv2.0/ --libdir=/opt/x86/opencv2.0/lib --includedir=/opt/x86/opencv2.0/include
说明:
--without-gtk //不用gtk
--without-carbon //与MC/OS相关
--without-quicktime
--without-1394libs
--without-ffmpeg
--without-python //不提共python语言接口
--without-swig //不提共swig语言接口
--enable-shared //编译成共享库
--prefix=/opt/x86/opencv2.0/ //安装路径
--libdir=/opt/x86/opencv2.0/lib
--includedir=/opt/x86/opencv2.0/include
configure运行后的总结报告如下:
make
make install (用root权限运行,因为这里是安装到根目录下)
在~/.bashrc文件最后加如下内容:
在/etc/ld.so.conf 文件的最后加上:/opt/x86/opencv2.0/lib
或者在/etc/ld.so.conf.d/目录下建一个文件opencv.conf,文件的内容为:/opt/x86/opencv2.0/lib
export PKG_CONFIG_PATH=/opt/x86/opencv2.0/lib/pkgconfig
到此,OK了!