当前位置:
文档之家› OPENCV2.4.2移植到TINY6410
OPENCV2.4.2移植到TINY6410
#cd build/generic
#./configure --prefix=/opt/arm/opencv --host=arm-linux --disable-assembly #make #make install
7、ffmpeg 的交叉编译:
#./configure --prefix= prefix=/opt/arm/opencv --enable-shared --disable-static --enable-gpl --enable-cross-compile --arch=arm --disable-stripping --target-os=linux --enable-libx264 --enable-libxvid --cc=arm-linux-gcc --enable-swscale --extra-cflags=-I/opt/arm/opencv/include --extra-ldflags=-L/opt/arm/opencv/lib #make #make install
解决方法:修改 CMakeCache.txt,WITH_TIFF:BOOL=ON,改成 OFF,重新 编译,错误消除。
#make install 三、测试
测试程序: #include #include #include
int main(int argc,char **argv) {
CvCapture* capture = NULL; IplImage* frame = NULL;
2、libjpeg 的交叉编译:
#./configure --host=arm-linux --prefix=/opt/arm/opencv --enable-shared --enable-static #make install
3、libpng 的交叉编译
#./configure --host=arm-linux --prefix=/opt/arm/opencv --enable-shared --enable-static #make #make install
cmake-2.8.8-Linux-i386.tar,gz
二、opencvΒιβλιοθήκη 2.3.1 的移植过程1、libz 的交叉编译:
# ./configure --prefix=/opt/arm/opencv --shared 修改 makefile CC=arm-linux-gcc AR=arm-linux-ar rc RANLIB=arm-linux-ranlib CDSHARED=arm-linux-gcc -shared -wl, -soname,libz.so.1,--version-script,zl lib.map #make #make install
解决方法: 修改 CMakeCache.txt,CMAKE_EXE_LINKER_FLAGS 原来为空,加上-lpthread -lrt, 重新编译,错误消除
错误二: Linking CXX executable ../../bin/opencv_createsamples ../../lib/libopencv_highgui.so: undefined reference to `_TIFFerrorHandler' ../../lib/libopencv_highgui.so: undefined reference to `_TIFFrealloc' ../../lib/libopencv_highgui.so: undefined reference to `_TIFFmalloc' ../../lib/libopencv_highgui.so: undefined reference to `_TIFFmemcpy' ../../lib/libopencv_highgui.so: undefined reference to `TIFFOpen' ../../lib/libopencv_highgui.so: undefined reference to `_TIFFfree'
if(!(capture = cvCaptureFromCAM(-1))) {
fprintf(stderr, "Can not open camera./n"); return -1; }
cvNamedWindow("video", 1);
while(frame = cvQueryFrame( capture ) ) {
../../lib/libopencv_highgui.so: undefined reference to `_TIFFwarningHandler' ../../lib/libopencv_highgui.so: undefined reference to `_TIFFmemcmp' ../../lib/libopencv_highgui.so: undefined reference to `_TIFFmemset'
opencv2.4.2 移植到 X4412
一、编译环境及库文件
linux 环境:CentOS65 交叉编译:4.5.1 arm 板子:X4412
libz: libjpeg: libpng: libyasm: opencv: libx264: libxvid: lffmpeg: cmake:
zlib-1.2.7 jpegsrc.v7 libpng-1.5.10 yasm-1.2.0 opencv-2.4.2 x264-snapshot-20120608-2245 xvidcore-1.3.2 ffmpeg-0.10.3
8.cmake-gui 安装 到官网上下载已经编译好的 cmake-2.8.8-Linux-i386.tar,gz,解压就可以了
9、opencv2.4.1 的交叉编译:
用到的主要目录说明:
交叉编译工具链所在目录
/opt/toolschain/4.5.1/bin
安装 opencv 的目录
/opt/arm/ffmpeg-arm/opencv-build
cvShowImage("video", frame); }
cvDestroyWindow("video");
cvReleaseCapture(&capture);
return 0; }
编译: #arm-linux-g++ -o opencv_test opencv_test.cpp -I /usr/local/include -L /usr/local/lib -lopencv_core -lopencv_highgui -lpthread -lrt
选择 Build 目录:/home/6410/opencv/opencv-2.4.2/build 点击 Configure,保持 generator 为 Unix Makefiles,选择 Specify options for cross-compiling,点击 Next, Operating System 填写 arm-linux C Compilers 填写 opt/FriendlyARM/toolschain/4.5.1/bin/arm-linux-gcc C++ Compilers 填写 opt/FriendlyARM/toolschain/4.5.1//bin/arm-linux-g++ 程序库的 Target Root 填写 opt/FriendlyARM/toolschain/4.5.1/ 然后点击 Finish。 默认安装目录为/usr/local,点击 Generate 生成 Makefile。
4、yasm 的交叉编译:
#./configure --host=arm-linux --prefix=/opt/arm/opencv --enable-shared --enable-static #make #make install
5、libx264 的交叉编译:
#CC=arm-linux-gcc ./configure --enable-shared --host=arm-linux --disable-asm --prefix=/opt/arm/opencv 修改 config.mak 中 CC=arm-none-linux-gnueabi-gcc AR=arm-none-linux-gnueabi-ar RANLIB=arm-none-linux-gnueabi-ranlib STRIP=arm-none-linux-gnueabi-strip 保持并退出 #make #make install 6、libxvid 的交叉编译:
opencv 源码所在目录
/opt/opencv/opencv-2.3.0/
编译好的 opencv 库所在目
录
/home/6410/opencv/opencv-2.4.2/build
#mkdir build #cd build 安装 cmake 和 cmake-gui 包 #yum install cmake cmake-gui #cmake-gui 选择源代码目录/home/6410/opencv/opencv-2.4.2/
#make
错误一:
Linking CXX executable ../../bin/opencv_createsamples ../../lib/libopencv_core.so: undefined reference to `clock_gettime' ../../lib/libopencv_highgui.so: undefined reference to `_TIFFerrorHandler' ../../lib/libopencv_highgui.so: undefined reference to `_TIFFrealloc' ../../lib/libopencv_core.so: undefined reference to `pthread_key_create