歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> OpenCV開源圖像處理函數庫在S3C2440移植

OpenCV開源圖像處理函數庫在S3C2440移植

日期:2017/3/1 11:15:37   编辑:Linux編程
一、簡介
  • 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.com\10月\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. LIBOPENCV := /home/openCV/install
  4. CFLAGS = -I$(LIBOPENCV)/include/opencv
  5. LDFLAGS = -L$(LIBOPENCV)/lib -lm -lcv -lcvaux -lcxcore -lhighgui -lml -lpthread -ljpeg -lpng -lrt -lcxcore -lz
  6. $(TARGET): $(SRC)
  7. arm-linux-g++ $(CFLAGS) $(SRC) -o $(TARGET) $(LDFLAGS)
  8. arm-linux-strip $(TARGET)
  9. clean:
  10. rm -rf $(TARGET)
Copyright © Linux教程網 All Rights Reserved