• Open Source Computer Vision Library

OpenCV在PowerPC平台上的移植

Wikipedia,自由的百科全书

目录

在嵌入式开发板中编译

编译器版本bash-3.00# g++ --version

g++ (GCC) 4.0.0 (DENX ELDK 4.1 4.0.0-4)

解压OpenCV源码,进入源码文件夹

./configure --without-python --without-gtk
General configuration =============================================
    Compiler:                 g++
    CXXFLAGS:                 -Wall -fno-rtti -pipe -O3 -g -mcpu=G3 -mtune=G5 -fomit-frame-pointer 
    Install path:             /usr/local
HighGUI configuration ============================================
    Windowing system --------------
    Use Carbon / Mac OS X:    no
    Use gtk+ 2.x:             no
    Use gthread:              no
    Image I/O ---------------------
    Use libjpeg:              no
    Use zlib:                 yes
    Use libpng:               no
    Use libtiff:              no
    Use libjasper:            no
    Use libIlmImf:            no
    Video I/O ---------------------
    Use QuickTime / Mac OS X: no
    Use xine:                 no
    Use ffmpeg:               no
    Use dc1394 & raw1394:     no
    Use v4l:                  no
    Use v4l2:                 no
Wrappers for other languages =======================================
    SWIG                      
    Python                    no
Additional build settings ===========================================
    Build demo apps           yes
Now run make ...

然后运行make和make install

$ cd tests/cxcore/src/
$ g++ -I/usr/local/include/opencv -I../../cxts -L/usr/local/lib -o cxcoretest *.cpp ../../cxts/*.cpp -lcv -lhighgui -lcxcore -lcvaux -lml -lpthread –ldl
$ ./cxcoretest

测试结果:见附录1

$ cd tests/cv/src/
$ g++ -I/usr/local/include/opencv -I../../cxts -L/usr/local/lib -o cvtest *.cpp  ../../cxts/*.cpp -lcv -lhighgui -lcxcore -lcvaux -lml -lpthread -ldl
$ mkdir tmp
$ mv cvtest tmp/
$ cd tmp
$ ./cvtest

测试结果见附录2

Debian/Linux交叉编译

(1) 升级完全

./configure --host=ppc CFLAGS=-I/usr/include CPPFLAGS=-I/usr/include LDFLAGS=-L/usr/lib CXX=ppc_4xxFP-g++

在otherlibs/highgui/cvcap_v4l.cpp中最前面加入

#define __i386__ 1 
./configure --host=ppc CFLAGS=-I/usr/include CPPFLAGS=-I/usr/include LDFLAGS=-L/usr/lib CXX=ppc_4xxFP-g++ 
General configuration =============================================
    Compiler:                 ppc_4xxFP-g++
    CXXFLAGS:                 -Wall -fno-rtti -pipe -O3 -g -mcpu=G3 -mtune=G5 -fomit-frame-pointer
    Install path:             /usr/local
HighGUI configuration ============================================
    Windowing system --------------
    Use Carbon / Mac OS X:    no
    Use gtk+ 2.x:             yes
    Use gthread:              yes
    Image I/O ---------------------
    Use libjpeg:              yes
    Use zlib:                 yes
    Use libpng:               yes
    Use libtiff:              yes
    Use libjasper:            yes
    Use libIlmImf:            no
    Video I/O ---------------------
    Use QuickTime / Mac OS X: no
    Use xine:                 no
    Use ffmpeg:               yes
    Use dc1394 & raw1394:     yes
    Use v4l:                  yes
    Use v4l2:                 yes
Wrappers for other languages =======================================
    SWIG
    Python                    no
Additional build settings ===========================================
    Build demo apps           yes
Now run make ...

修改Makefile文件,把里面的apps去掉

$ make
# make install
$ ppc_4xxFP-g++ -I/usr/local/include/opencv -I../../cxts -L/usr/local/lib -o cxcoretest *.cpp ../../cxts/*.cpp -lcv -lhighgui -lcxcore -lcvaux -lml -lpthread -ldl

将cxcoretest直接拷贝到板子里面运行、 测试结果与第一种相同

$ ppc_4xxFP-g++ -I/usr/local/include/opencv -I../../cxts -L/usr/local/lib -o cvtest *.cpp  ../../cxts/*.cpp -lcv -lhighgui -lcxcore -lcvaux -lml -lpthread -ldl

编译失败

(2)基本系统 ./configure --host=ppc CXX=ppc_4xxFP-g++

General configuration =============================================
    Compiler:                 ppc_4xxFP-g++
    CXXFLAGS:                 -Wall -fno-rtti -pipe -O3 -g -mcpu=G3 -mtune=G5 -fomit-frame-pointer
    Install path:             /usr/local
HighGUI configuration ============================================
    Windowing system --------------
    Use Carbon / Mac OS X:    no
    Use gtk+ 2.x:             no
    Use gthread:              no
    Image I/O ---------------------
    Use libjpeg:              no
    Use zlib:                 no
    Use libpng:               no
    Use libtiff:              no
    Use libjasper:            no
    Use libIlmImf:            no
    Video I/O ---------------------
    Use QuickTime / Mac OS X: no
    Use xine:                 no
    Use ffmpeg:               no
    Use dc1394 & raw1394:     no
    Use v4l:                  yes
    Use v4l2:                 yes
Wrappers for other languages =======================================
    SWIG
    Python                    no
Additional build settings ===========================================
    Build demo apps           yes
Now run make ...
$ make
# make install
$ ppc_4xxFP-g++ -I/usr/local/include/opencv -I../../cxts -L/usr/local/lib -o cxcoretest *.cpp ../../cxts/*.cpp -lcv -lhighgui -lcxcore -lcvaux -lml -lpthread -ldl

将cxcoretest直接拷贝到板子里面运行、 测试结果与第一种相同

$ ppc_4xxFP-g++ -I/usr/local/include/opencv -I../../cxts -L/usr/local/lib -o cvtest *.cpp  ../../cxts/*.cpp -lcv -lhighgui -lcxcore -lcvaux -lml -lpthread -ldl

测试结果与第一种相同

附录1

Engine: CxTest 0.1
Execution Date & Time: Thu Jan  1 00:59:32 1970
Config File: (null)
Tested Libraries: cxcore: 1.0.0
Optimized Low-level Plugin's: 
=================================================
-------------------------------------------------
arithm-absdiff: 	Ok
-------------------------------------------------
arithm-absdiffs: 	Ok
-------------------------------------------------
arithm-add: 	Ok
-------------------------------------------------
arithm-adds: 	Ok
-------------------------------------------------
arithm-addweighted: 	Ok
-------------------------------------------------
arithm-div: 	Ok
-------------------------------------------------
arithm-max: 	Ok
-------------------------------------------------
arithm-maxs: 	Ok
-------------------------------------------------
arithm-min: 	Ok
-------------------------------------------------
arithm-mins: 	Ok
-------------------------------------------------
arithm-mul: 	Ok
-------------------------------------------------
arithm-recip: 	Ok
-------------------------------------------------
arithm-sub: 	Ok
-------------------------------------------------
arithm-subrs: 	Ok
-------------------------------------------------
cmp-cmp: 	FAIL(Bad accuracy)
-------------------------------------------------
cmp-cmps: 	FAIL(Bad accuracy)
-------------------------------------------------
cmp-inrange: 	FAIL(Bad accuracy)
-------------------------------------------------
cmp-inranges: 	Ok
-------------------------------------------------
cvt-scale: 	FAIL(Bad accuracy)
-------------------------------------------------
cvt-scaleabs: 	FAIL(Bad accuracy)
-------------------------------------------------
ds-graph: 	Ok
-------------------------------------------------
ds-graphscan: 	Ok
-------------------------------------------------
ds-seq-base: 	FAIL(Invalid function output)
-------------------------------------------------
ds-seq-sortinv: 	FAIL(Invalid function output)
-------------------------------------------------
ds-set: 	Ok
-------------------------------------------------
dxt-dct: 	Ok
-------------------------------------------------
dxt-dft: 	Ok
-------------------------------------------------
dxt-mulspectrums: 	FAIL(Bad accuracy)
-------------------------------------------------
logic-and: 	Ok
-------------------------------------------------
logic-ands: 	Ok
-------------------------------------------------
logic-not: 	Ok
-------------------------------------------------
logic-or: 	Ok
-------------------------------------------------
logic-ors: 	Ok
-------------------------------------------------
logic-xor: 	Ok
-------------------------------------------------
logic-xors: 	Ok
-------------------------------------------------
math-cart2polar: 	Ok
-------------------------------------------------
math-exp: 	Ok
-------------------------------------------------
math-log: 	Ok
-------------------------------------------------
math-polar2cart: 	Ok
-------------------------------------------------
math-pow: 	Ok
-------------------------------------------------
matrix-covar: 	Ok
-------------------------------------------------
matrix-crossproduct: 	Ok
-------------------------------------------------
matrix-det: 	Ok
-------------------------------------------------
matrix-dotproduct: 	Ok
-------------------------------------------------
matrix-gemm: 	Ok
-------------------------------------------------
matrix-invert: 	Ok
-------------------------------------------------
matrix-mahalanobis: 	Ok
-------------------------------------------------
matrix-multransposed: 	Ok
-------------------------------------------------
matrix-perspective: 	FAIL(Bad accuracy)
-------------------------------------------------
matrix-scaleadd: 	Ok
-------------------------------------------------
matrix-solve: 	Ok
-------------------------------------------------
matrix-svbksb: 	Ok
-------------------------------------------------
matrix-svd: 	Ok
-------------------------------------------------
matrix-trace: 	Ok
-------------------------------------------------
matrix-transform: 	Ok
-------------------------------------------------
mem-copy: 	Ok
-------------------------------------------------
mem-fill: 	Ok
-------------------------------------------------
mem-flip: 	Ok
-------------------------------------------------
mem-merge: 	Ok
-------------------------------------------------
mem-setidentity: 	Ok
-------------------------------------------------
mem-setzero: 	Ok
-------------------------------------------------
mem-split: 	Ok
-------------------------------------------------
mem-transpose: 	Ok
-------------------------------------------------
stat-mean: 	FAIL(Bad accuracy)
-------------------------------------------------
stat-mean_stddev: 	Ok
-------------------------------------------------
stat-minmaxloc: 	Ok
-------------------------------------------------
stat-nonzero: 	Ok
-------------------------------------------------
stat-norm: 	Ok
-------------------------------------------------
stat-sum: 	Ok
=================================================
Summary: 10 out of 69 tests failed
Running time: 00:28:37

附录2

Engine: CxTest 0.1
Execution Date & Time: Thu Jan  1 00:02:44 1970
Config File: (null)
Tested Libraries: cxcore: 1.0.0
Optimized Low-level Plugin's: 
=================================================
-------------------------------------------------
_3d-cvt-homogen: 	Ok
-------------------------------------------------
_3d-epilines: 	Ok
-------------------------------------------------
_3d-fundam: 	Ok
-------------------------------------------------
_3d-rodrigues: 	Ok
-------------------------------------------------
accum-acc: 	Ok
-------------------------------------------------
accum-mulacc: 	Ok
-------------------------------------------------
accum-runavg: 	Ok
-------------------------------------------------
accum-squareacc: 	Ok
-------------------------------------------------
calibratecamera: 	Ok
-------------------------------------------------
canny: 	Ok
-------------------------------------------------
chessboard-detector: 	Ok
-------------------------------------------------
color-bayer: 	Ok
-------------------------------------------------
color-gray: 	Ok
-------------------------------------------------
color-hls: 	Ok
-------------------------------------------------
color-hsv: 	Ok
-------------------------------------------------
color-lab: 	Ok
-------------------------------------------------
color-luv: 	Ok
-------------------------------------------------
color-rgb: 	Ok
-------------------------------------------------
color-xyz: 	Ok
-------------------------------------------------
color-ycc: 	Ok
-------------------------------------------------
contour-approx: 	Ok
-------------------------------------------------
contour-find: 	FAIL(Bad accuracy)
-------------------------------------------------
distrans: 	Ok
-------------------------------------------------
emd: 	Ok
-------------------------------------------------
features-evalvec: 	Ok
-------------------------------------------------
features-mineval: 	Ok
-------------------------------------------------
features-precorner: 	Ok
-------------------------------------------------
filter-blur: 	Ok
-------------------------------------------------
filter-gaussian: 	Ok
-------------------------------------------------
filter-generic: 	Ok
-------------------------------------------------
filter-laplace: 	Ok
-------------------------------------------------
filter-median: 	Ok
-------------------------------------------------
filter-sobel: 	Ok
-------------------------------------------------
floodfill: 	Ok
-------------------------------------------------
hist-backproj: 	Ok
-------------------------------------------------
hist-backprojpatch: 	Ok
-------------------------------------------------
hist-bayesianprob: 	Ok
-------------------------------------------------
hist-calc: 	Ok
-------------------------------------------------
hist-compare: 	Ok
-------------------------------------------------
hist-minmax: 	Ok
-------------------------------------------------
hist-normalize: 	Ok
-------------------------------------------------
hist-query: 	Ok
-------------------------------------------------
hist-threshold: 	Ok
-------------------------------------------------
integral: 	Ok
-------------------------------------------------
kalman: 	Ok
-------------------------------------------------
match-template: 	Ok
-------------------------------------------------
mhi-global: 	Ok
-------------------------------------------------
mhi-gradient: 	Ok
-------------------------------------------------
mhi-update: 	Ok
-------------------------------------------------
moments-hu: 	Ok
-------------------------------------------------
moments-raster: 	Ok
-------------------------------------------------
morph-dilate: 	Ok
-------------------------------------------------
morph-erode: 	Ok
-------------------------------------------------
optflow-pyrlk: 	Ok
-------------------------------------------------
posit: 	Ok
-------------------------------------------------
pyramid-down: 	Ok
-------------------------------------------------
pyramid-up: 	Ok
-------------------------------------------------
segmentation-pyramid: 	Ok
-------------------------------------------------
shape-convhull: 	Ok
-------------------------------------------------
shape-fit-ellipse: 	Ok
-------------------------------------------------
shape-fit-line: 	Ok
-------------------------------------------------
shape-minarearect: 	Ok
-------------------------------------------------
shape-mincircle: 	Ok
-------------------------------------------------
shape-moments: 	Ok
-------------------------------------------------
shape-perimeter: 	Ok
-------------------------------------------------
snakes: 	Ok
-------------------------------------------------
subdiv: 	Ok
-------------------------------------------------
thresh-simple: 	Ok
-------------------------------------------------
track-camshift: 	Ok
-------------------------------------------------
track-meanshift: 	Ok
-------------------------------------------------
warp-affine: 	Ok
-------------------------------------------------
warp-perspective: 	Ok
-------------------------------------------------
warp-remap: 	Ok
-------------------------------------------------
warp-resize: 	Ok
-------------------------------------------------
warp-subpix-quad: 	Ok
-------------------------------------------------
warp-subpix-rect: 	Ok
-------------------------------------------------
warp-undistort: 	Ok
-------------------------------------------------
warp-undistort-map: 	Ok
=================================================
Summary: 1 out of 78 tests failed
Running time: 00:36:27

作者

  • Xueketan@OpenCV China,谭学科,大连理工大学硕士研究生,Email:xueketan@student.dlut.edu.cn
Views
Personal tools