opencv开源图像处理函数库在S3C2440移植

一、简介
  • OpenCV是一个基于C/C++语言的开源图像处理函数库
  • 其代码都经过优化,可用于实时处理图像
  • 具有良好的可移植性
  • 可以进行图像/视频载入、保存和采集的常规操作
  • 具有低级和高级的应用程序接口(API)

二、功能说明
  • 图像数据操作(内存分配与释放,图像复制、设定和转换)
Image data manipulation (allocation, release, copying, setting, conversion).
  • 图像/视频的输入输出(支持文件或摄像头的输入,图像/视频文件的输出)
Image and video I/O (file and camera based input, image/video file output).
  • 矩阵/向量数据操作及线性代数运算(矩阵乘积、矩阵方程求解、特征值、奇异值分解)
Matrix and vector manipulation and linear algebra routines (products, solvers, eigenvalues, SVD).
  • 支持多种动态数据结构(链表、队列、数据集、树、图)
Various dynamic data structures (lists, queues, sets, trees, graphs).
  • 基本图像处理(去噪、边缘检测、角点检测、采样与插值、色彩变换、形态学处理、直方图、图像金字塔结构)
Basic image processing (filtering, edge detection, corner detection, sampling and interpolation, color conversion, morphological operations, histograms, image pyramids).
  • 结构分析(连通域/分支、轮廓处理、距离转换、图像矩、模板匹配、霍夫变换、多项式逼近、曲线拟合、椭圆拟合、狄劳尼三角化)
Structural analysis (connected components, contour processing, distance transform, various moments, template matching, Hough transform, polygonal approximation, line fitting, ellipse fitting, Delaunay triangulation).
  • 摄像头定标(寻找和跟踪定标模式、参数定标、基本矩阵估计、单应矩阵估计、立体视觉匹配)
Camera calibration (finding and tracking calibration patterns, calibration, fundamental matrix estimation, homography estimation, stereo correspondence).
  • 运动分析(光流、动作分割、目标跟踪)
Motion analysis (optical flow, motion segmentation, tracking).
  • 目标识别(特征方法、HMM模型)
Object recognition (eigen-methods, HMM).
  • 基本的GUI(显示图像/视频、键盘/鼠标操作、滑动条)
Basic GUI (display image/video, keyboard and mouse handling, scroll-bars).
  • 图像标注(直线、曲线、多边形、文本标注)
Image labeling (line, conic, polygon, text drawing)

三、在S3C2440上移植
   环境:RedHat AS5
1、涉及的文件
libjpeg: http://www.rayfile.com/zh-cn/files/2a4d4dfa-c267-11e0-b204-0015c55db73d/
libpng: http://www.rayfile.com/zh-cn/files/4d7b34b8-c267-11e0-909e-0015c55db73d/
libz: http://www.rayfile.com/zh-cn/files/69cb96bd-c267-11e0-8619-0015c55db73d/
openCV2.0: http://www.rayfile.com/zh-cn/files/a1df3f68-c267-11e0-989c-0015c55db73d/

2、编译OpenCV的完整过程:
step0:准备环境变量
#export OPENCV_BUILD_DIR=/home/openCV/install

step1: 编译zlib
#tar xzf zlib-1.2.4.tar.gz
#cd zlib-1.2.4
./configure --prefix=$OPENCV_BUILD_DIR/install
#vi Makefile
替换gcc为arm-linux-gcc
替换ar为arm-linux-ar
替换ranlib为arm-linux-ranlib
#make
#make install


step2:编译jpeg库
#tar xzf jpegsrc.v8a.tar.gz
#cd jpeg-8a
./configure --host=arm-linux --prefix=$OPENCV_BUILD_DIR/install
#make
#make install


step3:编译libpng库
#tar xzf libpng-1.2.43.tar.gz
#cd libpng-1.2.43
./configure --host=arm-linux --prefix=$OPENCV_BUILD_DIR/install
#make
#make install


step4:编译OpenCV
#tar xjf OpenCV-2.0.0.tar.bz2
#cd OpenCV-2.0.0

#./configure --host=arm-linux --without-gtk --without-carbon  --without-quicktime --without-1394libs --without-ffmpeg --without-python --without-swig --disable-static --enable-shared --disable-apps CXX=arm-linux-g++  --prefix=$OPENCV_BUILD_DIR/install --libdir=$OPENCV_BUILD_DIR/install/lib -includedir=$OPENCV_BUILD_DIR/install/include
#make
#make install


最后,strip生成的库:
#find | xargs file | grep "not stripped" | cut -d: -f1 | xargs arm-linux-strip

3、编译程序
编译基于openCV库的应用程序一般使用以下Makefile配合编译:
注意LIBOPENCV变量的取值跟上面的一致
TARGET = cvRect
SRC = cvRect.cpp


LIBOPENCV := /home/openCV/install
CFLAGS = -I$(LIBOPENCV)/include/opencv
LDFLAGS = -L$(LIBOPENCV)/lib -lm -lcv -lcvaux -lcxcore -lhighgui -lml -lpthread -ljpeg -lpng -lrt -lcxcore -lz


$(TARGET): $(SRC)
	arm-linux-g++ $(CFLAGS) $(SRC) -o $(TARGET) $(LDFLAGS)
	arm-linux-strip $(TARGET)


clean:
	rm -rf $(TARGET)


评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值