RayDon 2011-03-12
Linux 下 OpenCV2.0 的编译与安装 (ARM9)与(x86)
环境:
PC机系统:Ubuntu 10.10 (linux2.6.35-23)
目标板:天嵌2440 统 (系:Qt4.7,内核:2.6.30)
arm-linux-gcc:4.3.3
解压:OpenCV-2.0.0.tar.bz2
#cd OpenCV-2.0.0
///////////// for x86 /////////////////
./configure --without-gtk --without-carbon --without-quicktime --without-1394libs --without-ffmpeg --without-python --without-swig --enable-static --enable-shared --disable-apps CXX=g++ --with-v4l2 --prefix=/opt/x86/opencv --libdir=/opt/x86/opencv/lib -includedir=/opt/x86/opencv/include
///////////// for arm /////////////////
#./configure --host=arm-linux --without-gtk --without-carbon --without-quicktime --without-1394libs --without-ffmpeg --without-python --without-swig --enable-static --enable-shared --disable-apps CXX=arm-linux-g++ CPPFLAGS=-I/opt/EmbedSky/4.3.3/arm-none-linux-gnueabi/include LDFLAGS=-L/opt/EmbedSky/4.3.3/arm-none-linux-gnueabi/libc/lib --with-v4l2 --prefix=/opt/arm/opencv --libdir=/opt/arm/opencv/lib -includedir=/opt/arm/opencv/include
其中选项:
? --host=arm-linux
? --without-gtk:
? --without-carbon:
? --without-quicktime
? --without-1394libs
? --without-ffmpeg
? --without-python
? --without-swig
? --enable-static
? --disable-shared:
? CXX=arm-linux-g++
? CPPFLAGS=-I/opt/EmbedSky/4.3.3/arm-none-linux-gnueabi/include:OpenCV会用到一些dev的包,如png.h,jpeglib.h头,大部分文件在/usr/include下。
? LDFLAGS=-L/opt/EmbedSky/4.3.3/arm-none-linux-gnueabi/libc/lib
? --prefix=/opt/arm/opencv
? --libdir=/opt/arm/opencv/lib
? -includedir=/opt/arm/opencv/include
#make
#make install
移植到arm文件系统
将/opt/arm/opencv/lib里的
libcvaux.so.4.0.0
libcv.so.4.0.0
libcxcore.so.4.0.0
libhighgui.so.4.0.0
libml.so.4.0.0
拷出来全部重命名
*.so.4
QT *.pro文件中到设置
x86的设置:
INCLUDEPATH += /opt/x86/opencv/include/opencv
LIBS += -L/opt/x86/opencv/lib -lcv -lhighgui -lcxcore
将opencv的lib路径加入 /etc/ld.so.conf 并执行命令 ldconfig
arm的设置:
INCLUDEPATH += /opt/arm/opencv/include/opencv
LIBS += -L/opt/arm/opencv/lib -lcxcore -lhighgui -lcv
将opencv的lib路径加入到 LD_LIBRARY_PATH 变量中