您的位置:首页 > 运维架构

ubuntu12.04安装opencv-1.0.0的问题(希望大家进来讨论一下)

2013-02-16 18:27 411 查看
一、下载opencv-1.0.0.tar.gz(http://www.opencv.org.cn/index.php/Download#Version_1.0)

二、解压缩源代码 tar -xzvf opencv-1.0.0.tar.gz

三、进入解压缩后的源代码目录,修改文件./cxcore/include/cxmisc.h中第133行,#elif 改为#else, 如果不改,make时会报不能为空之类的错误。

四、解决 linux/videodev.h: No such file or directory的问题

1、

sudo apt-get install libv4l-dev


2、修改./otherlibs/highgui/cvcap_v4l.cpp的第208行,将
"#include <linux/videodev.h>"
替换为

#include <libv4l1-videodev.h>


五、解决make时报undefine reference to XXXcav4XXX之类的错误。

1、./config --prefix=/usr/local/ywopencv

2、在配置完后会生成文件cvconfig.h,在该文件中添加

#define HAVE_CAMV4L


参考链接https://code.ros.org/trac/opencv/ticket/324

六、 sudo make

七、sudo make install

八、修改动态链接库配置文件

1、vi /etc/ld.so.conf.d 添加目录/usr/local/ywopencv/lib

2、执行 ldconfig -v 将显示系统所有的共享动态链接库,opencv共享库如下

/usr/local/ywopencv/lib:
libhighgui.so.1 -> libhighgui.so.1.0.0
libml.so.1 -> libml.so.1.0.0
libcvaux.so.1 -> libcvaux.so.1.0.0
libcxcore.so.1 -> libcxcore.so.1.0.0
libcv.so.1 -> libcv.so.1.0.0
九、cp /usr/local/opencv/lib/pkgconfig/opencv.pc /use/local/lib/pkgconfig

此时执行命令 pkd-config opencv --cflags --libs将会显示opencv的安装的头文件目录和库目录,如下所示

-I/usr/local/ywopencv/include/opencv -L/usr/local/ywopencv/lib -lcxcore -lcv -lhighgui -lcvaux -lml

十、进入实例源代码编译运行,cd /usr/local/ywopencv/share/opencv/samples/c

gcc 'pkd-config opencv --cflags --libs' drawing.c -o drawing

j结果出现如下问题:希望大家一起来讨论一下,如何解决这个问题???进来的一起讨论

/tmp/cci3G9En.o: In function `cvDecRefData':
drawing.c:(.text+0xa62): undefined reference to `cvFree_'
drawing.c:(.text+0xad3): undefined reference to `cvFree_'
/tmp/cci3G9En.o: In function `cvGetRow':
drawing.c:(.text+0xbc9): undefined reference to `cvGetRows'
/tmp/cci3G9En.o: In function `cvGetCol':
drawing.c:(.text+0xbf4): undefined reference to `cvGetCols'
/tmp/cci3G9En.o: In function `cvReleaseMatND':
drawing.c:(.text+0xc07): undefined reference to `cvReleaseMat'
/tmp/cci3G9En.o: In function `cvSubS':
drawing.c:(.text+0xd27): undefined reference to `cvAddS'
/tmp/cci3G9En.o: In function `cvCloneSeq':
drawing.c:(.text+0xd75): undefined reference to `cvSeqSlice'
/tmp/cci3G9En.o: In function `cvSetNew':
drawing.c:(.text+0xdd4): undefined reference to `cvSetAdd'
/tmp/cci3G9En.o: In function `cvGetSetElem':
drawing.c:(.text+0xe67): undefined reference to `cvGetSeqElem'
/tmp/cci3G9En.o: In function `cvEllipseBox':
drawing.c:(.text+0xf67): undefined reference to `cvEllipse'
/tmp/cci3G9En.o: In function `cvFont':
drawing.c:(.text+0xfb1): undefined reference to `cvInitFont'
/tmp/cci3G9En.o: In function `cvReadIntByName':
drawing.c:(.text+0x105f): undefined reference to `cvGetFileNodeByName'
/tmp/cci3G9En.o: In function `cvReadRealByName':
drawing.c:(.text+0x10f0): undefined reference to `cvGetFileNodeByName'
/tmp/cci3G9En.o: In function `cvReadStringByName':
drawing.c:(.text+0x114a): undefined reference to `cvGetFileNodeByName'
/tmp/cci3G9En.o: In function `cvReadByName':
drawing.c:(.text+0x117a): undefined reference to `cvGetFileNodeByName'
drawing.c:(.text+0x1190): undefined reference to `cvRead'
/tmp/cci3G9En.o: In function `cvCreateSubdivDelaunay2D':
drawing.c:(.text+0x11c3): undefined reference to `cvCreateSubdiv2D'
drawing.c:(.text+0x11ed): undefined reference to `cvInitSubdivDelaunay2D'
/tmp/cci3G9En.o: In function `cvCalcHist':
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐