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

2024-06-13  

一、简介

  • 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、libpng、libz、openCV2.0 。

  • 下载在

  • $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

  • 下载在Linux公社的1号FTP服务器里,下载地址:

    FTP地址:ftp://www.linuxidc.com

    用户名:www.linuxidc.com

    密码:www.muu.cc

    在 2011年LinuxIDC.com10月OpenCV开源图像处理函数库在S3C2440移植

    下载方法见 http://www.linuxidc.net/thread-1187-1-1.html

  • $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$

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变量的取值跟上面的一致

  •  

    1. TARGET = cvRect  

    2. SRC = cvRect.cpp  

    3.   

    4.   

    5. LIBOPENCV := /home/openCV/install  

    6. CFLAGS = -I$(LIBOPENCV)/include/opencv  

    7. LDFLAGS = -L$(LIBOPENCV)/lib -lm -lcv -lcvaux -lcxcore -lhighgui -lml -lpthread -ljpeg -lpng -lrt -lcxcore -lz  

    8.   

    9.   

    10. $(TARGET): $(SRC)  

    11.     arm-linux-g++ $(CFLAGS) $(SRC) -o $(TARGET) $(LDFLAGS)  

    12.     arm-linux-strip $(TARGET)  

    13.   

    14.   

    15. clean:  

    16.     rm -rf $(TARGET)  



文章来源于:电子工程世界    原文链接
本站所有转载文章系出于传递更多信息之目的,且明确注明来源,不希望被转载的媒体或个人可与我们联系,我们将立即进行删除处理。