Presentation is loading. Please wait.

Presentation is loading. Please wait.

電腦視覺: OpenCV 簡介.

Similar presentations


Presentation on theme: "電腦視覺: OpenCV 簡介."— Presentation transcript:

1 電腦視覺: OpenCV 簡介

2 大綱 電腦視覺資料庫 (OpenCV) 功能簡介 環境設定 簡單的範例 OpenCV 專案
與Visual Studio 2012 C++ express整合 簡單的範例 讀圖&高斯模糊 開啟攝影機 OpenCV 專案 影像差異 人臉偵測 物件偵測

3 關於OpenCV OpenCV(開放原始碼之電腦視覺)包含眾多即時 電腦視覺功能的函式庫。 應用領域: 影像處理 人機介面(HCI)
物件辨識 影像切割 人臉辨識 手勢辨識 移動偵測 動作認知 場景重構(Structure From Motion) 立體聲和多台攝影機校正及深度計算 移動機器人視覺

4 HI! OpenCV http://opencv.org/
從英特爾1999年發布OpenCV以來,功 能仍持續更新與增加中,目前由itseez 維護 最新的版本為2.4.8 (Dec. 2013) 1.x 的原始碼是用C語言編寫,2.x改以 C++編寫 跨平台: Windows, xNIX, MacOS, Android, iOS, etc… 超過2500個函式

5 Books

6 OpenCV 發展歷史 動機起源於讓電腦視覺有更低的門檻,並充分利 用 Intel 處理器的運算效能 Timeline:
Gary Bradski (c) 2008 Gary Bradski, 2009

7 應用範例:自動駕駛

8 OpenCV Overview: > 2500 functions Robot support 通用圖像處理函式 影像金字塔 特徵描述
切割 攝影機校正 特徵擷取 轉換 工具和資料結構 追蹤 機器學習 偵測與辨識 Fitting 矩陣數學

9 OpenCV Structure CV MLL HighGUI CXCORE IPP Aux Image Processing and
Vision Algorithms MLL Statistical Classifiers and Clustering Tools HighGUI GUI, Image and Video I/O CXCORE basic structures and algorithms, XML support, drawing functions IPP Fast architecture-specific low-level functions Aux Experimental or less used routines Gary Bradski, 2009 9 9

10 API Modules core - a compact module defining basic data structures, including the dense multi-dimensional array Mat and basic functions used by all other modules. imgproc - an image processing module that includes linear and non-linear image filtering, geometrical image transformations (resize, affine and perspective warping, generic table-based remapping), color space conversion, histograms, and so on. video - a video analysis module that includes motion estimation, background subtraction, and object tracking algorithms. calib3d - basic multiple-view geometry algorithms, single and stereo camera calibration, object pose estimation, stereo correspondence algorithms, and elements of 3D reconstruction. features2d - salient feature detectors, descriptors, and descriptor matchers. objdetect - detection of objects and instances of the predefined classes (for example, faces, eyes, mugs, people, cars, and so on). highgui - an easy-to-use interface to video capturing, image and video codecs, as well as simple UI capabilities. gpu - GPU-accelerated algorithms from different OpenCV modules.

11 下載 OpenCV for Windows OpenCV for Linux/Mac OpenCV for Android
OpenCV for iOS

12 安裝與設定 使用 Visual Studio 2012 (中文)
13/10/25/image_process_intro_opencv.aspx u.php?id=%E8%91%89%E6%AD%A3%E8%81%96% E8%80%81%E5%B8%AB:%E6%95%99%E7%A0%94 %E7%A9%B6%E7%94%9F%E5%AD%B8opencv ction/windows_visual_studio_Opencv/windows_ visual_studio_Opencv.html#windows-visual- studio-how-to

13 OpenCV Tutorials Core module: Image processing module

14 範例

15 讀圖及高斯模糊

16 讀圖及高斯模糊(處理結果)

17 存取像素

18 結果

19 開啟攝影機

20 影像差異 連續影像相減(Temporal differencing) 原理是利用再時間上連續的影像做一對 一的像素相減
若是兩者差異為零,就表示此像素不屬 於移動物件像素 反之,則此像素為移動物件像素。

21 簡介 由前後Frame相減,可以找出不相同的 部位 但無法看出動作的方向

22 Frame Difference 程式碼

23 優點及缺點 優點: 缺點: 計算簡單快速 此法對於環境的改變適應性佳 但是偵測出的移動物件常常會發生內部破 碎的情形
移動物件的形狀較不完整,對於後續的移 動物件追蹤與辨識將無法提供完整的資訊

24 人臉偵測

25 介紹 如何偵測具有特徵的物體,例如人臉?

26 挑戰 收集並標示數據是很重要的,但很花時 間 如何取得的想要的特徵 如何分類 如何測試或檢驗 還好,我們有openCV
即使是巢狀或串級的分類 如何測試或檢驗 還好,我們有openCV

27 How to use Try our package – FaceDetection
FaceDetect.cmd Usage: facedetect [-- cascade="<cascade_path>"] [--nested-cascade[="nested_cascade_path"]] [--scale[=<image scale> [filename|camera_index] FaceDetect.exe 執行辨識的程式

28 正面臉部偵測 Facedetect --cascade="./haarcascades/haarcascade_frontalface_alt.xml” --nested-cascade="./haarcascades/haarcascade_eye.xml” --scale=1.3 先找到在正面的臉 接者尋找眼睛 縮放標記

29 試試其他模組 haarcascade_eye.xml haarcascade_eye_tree_eyeglasses.xml
haarcascade_frontalface_alt.xml haarcascade_frontalface_alt2.xml haarcascade_frontalface_alt_tree.xml haarcascade_frontalface_default.xml haarcascade_fullbody.xml haarcascade_lefteye_2splits.xml haarcascade_lowerbody.xml haarcascade_mcs_eyepair_big.xml haarcascade_mcs_eyepair_small.xml haarcascade_mcs_lefteye.xml haarcascade_mcs_mouth.xml haarcascade_mcs_nose.xml haarcascade_mcs_righteye.xml haarcascade_mcs_upperbody.xml haarcascade_profileface.xml haarcascade_righteye_2splits.xml haarcascade_upperbody.xml

30 如何製作自己的Object Detector
Collect a database of positive samples and a database of negative samples. Mark object by objectmarker.exe Build a vec file out of positive samples using createsamples.exe Run haartraining.exe to build the classifier. Run performance.exe to evaluate the classifier. Run haarconv.exe to convert classifier to .xml file

31 Links Original paper: bs/Detect/violaJones_CVPR2001.pdf How-to build a cascade of boosted classifiers based on Haar-like features: hida/opencv/OpenCV_ObjectDetection_ HowTo.pdf Objectmarker.exe and haarconv.exe, *.dll: arkit.rar training.html

32 推薦的參考網站 Another Introduction e1_Introduction.pdf Open Computer Vision Library (Sourceforge) OpenCV Official Forum OpenCV中文網站 優質OpenCV教學網 Learning OpenCV: Computer Vision with the OpenCV Library (Paperback) Library/dp/

33 參考資料 http://vbie.eic.nctu.edu.tw/vol_2/skill_7.htm
state.edu/~jwdavis/CVL/Research/MHI/mhi.h tml 特徵檢測專題 %E5%BE%81%E6%A3%80%E6%B5%8B%E4%B8%9 3%E9%A2%98


Download ppt "電腦視覺: OpenCV 簡介."

Similar presentations


Ads by Google