Responsive image
博碩士論文 etd-0802116-120551 詳細資訊
Title page for etd-0802116-120551
論文名稱
Title
研究以樹莓派為平台之智慧監控系統實作
The Study of Implementing a Smart Surveillance Subsystem on Raspberry Pi
系所名稱
Department
畢業學年期
Year, semester
語文別
Language
學位類別
Degree
頁數
Number of pages
189
研究生
Author
指導教授
Advisor
召集委員
Convenor
口試委員
Advisory Committee
口試日期
Date of Exam
2016-07-25
繳交日期
Date of Submission
2016-09-02
關鍵字
Keywords
FFmpeg、GlusterFS、GCM、LIVE555、Three-Frame Differencing演算法、OpenCV、Android、樹莓派、移動偵測
Raspberry Pi, Motion Detection, Android, OpenCV, Three-Frame Differencing Algorithm, FFmpeg, GlusterFS, GCM, LIVE555
統計
Statistics
本論文已被瀏覽 5720 次,被下載 254
The thesis/dissertation has been browsed 5720 times, has been downloaded 254 times.
中文摘要
隨著社會犯罪率的提高,人們開始重視居家安全,但是卻沒有很好的辦法可以即時、提早發現「家」中的犯罪,普遍市面上的居家監控系統雖然可以對居家安全進行監控,但是卻沒有辦法即時的偵測可能的犯罪事件並回報給使用者,再者市面上的監控系統必須要一直處於錄製的狀態,如果可以只錄製事件發生的影片片段,相信不只增加使用者在事後蒐證上的便利性,也能節省耗電和儲存設備空間的消耗。居家安全真正要考慮的另一個問題,其實是居家生活中老人和小孩的潛在危險,像是跌倒/墜落、燒燙傷和梗塞窒息,如果使用者可以透過行動裝置即時監控家中的狀況,相信可以有效預防家中不必要的事故發生。
基於樹莓派[1, 2]價格低和耗電量低的優勢,本論文使用樹莓派為基礎開發平台,實作居家監控裝置,並提供Android前端應用程式介面與裝置進行互動。本論文實作分為三部分,智慧監控裝置、雲端服務和Android應用程式介面,智慧監控裝置提供移動偵測、行動事件通知、影片錄製上傳、即時串流等功能,行動偵測演算法結合Collins et al在VSAM計畫中所提出的Three-Frame Differencing演算法與標準差運算有效的偵測攝影機行動的發生[3-5],演算法使用Open Source Computer Vision Library (OpenCV)函式庫[6]實作,影片錄製上傳和即時串流功能使用FFmpeg[7]工具實作,雲端服務整合了GlusterFS[8]以及以GCM[9]實作的訊息伺服器和以LIVE555[10]實作的動態即時串流伺服器,雲端服務提供影片的存取、裝置端與應用程式間訊息的傳遞和即時影片串流功能方便裝置端和手機端之間互動,最後Android應用程式介面提供四個功能,分別是行動事件通知、行動事件歷史紀錄搜尋、即時影片串流和裝置訂閱功能,透過手機應用程式介面使用者可以很容易的監控家中的一舉一動,避免不必要的危險發生。
Abstract
As the social crimes get higher, people start to realize how important home safety is, but there is no good way to detect home crimes immediately and early. Conventional home surveillance system cannot detect possible crime and notice user instantly. Further, system must record all the time and it cannot only detect and record possible crime segments. If it can do that, I believe it not only increases convenience on evidence collection, but also saves the cost of electricity and waste storage. Another important thing we have to consider is the potential danger of the old man and children, such as falling, burn, infarct suffocation, etc. If we can use a mobile device to instantly monitor our home, I believe we can efficiently prevent some unnecessary accidents happened at home.
Due to the advantages of Raspberry Pi includes low price and power consumption, I decide to use Raspberry Pi as my developed device and implement an Android application to interact with it. The implementation in my system separates into three parts, smart surveillance device, cloud service and Android application. The device supports several functions include motion detection, motion event notification, video record and upload, streaming. In motion detection function, I use Three-Frame Differencing algorithm developed by Collins et al in VSAM project and Standard Deviation to detect moving objects effectively. In cloud service implementation, here integrates three servers include GlusterFS, GCM server and the Dynamic RTSP Server uses LIVE555 libraryto achieve provide video access, communication, streaming functions. Application supports motion event notification, event search, streaming and device subscription. According to the application, user can easily monitor their house and provide a safety environment.
目次 Table of Contents
論文審定書 i
論文公開授權書 ii
誌謝 iii
摘要 iv
Abstract v
目錄 vi
圖次 xii
表次 xviii
第一章 序論 1
1.1 研究動機 1
1.2 研究目的 1
1.3 論文架構 2
第二章 研究背景 3
2.1 Raspberry Pi 3
2.1.1 簡介 3
2.1.2 硬體規格 4
2.1.3 作業系統 5
2.2 Logitech C920 HD Pro 7
2.3 Raspbian 7
2.4 Video4Linux2 (V4l2) 8
2.4.1 簡介 8
2.4.2 註冊和open() 9
2.4.2.1 視頻裝置註冊 11
2.4.2.2 open()和release() 12
2.4.3 基本ioctl()處理 13
2.4.4 顏色和視頻格式 15
2.4.4.1 色域 15
2.4.4.2 密集儲存和平面儲存 16
2.4.4.3 Fourcc編碼 16
2.4.4.4 RGB格式 17
2.4.4.5 VUV格式 18
2.4.4.6 其它格式 20
2.4.4.7 格式描述 20
2.4.5 基本的幀I/O 21
2.4.5.1 read()和write() 21
2.4.5.2 串流參數 22
2.4.6 串流I/O 24
2.4.6.1 v4l2_buffer資料結構 24
2.4.6.2 緩衝區設定 27
2.4.6.3 將緩衝區映射到用戶空間 28
2.4.6.4 串流I/O操作 28
2.5 FFmpeg 30
2.5.1 歷史 30
2.5.2 元件 31
2.5.3 支援編解碼器、容器格式和傳輸協定 32
2.5.3.1 編解碼器 32
2.5.3.2 容器格式 33
2.5.3.3 傳輸協定 34
2.6 OpenCV 34
2.7 Three-Frame Differencing演算法 35
2.8 LIVE555多媒體串流 37
2.9 Real Time Stream Protocol (RTSP) 38
2.9.1 Real-time Transport Protocol (RTP) 38
2.9.2 RTP Control Protocol (RTCP) 38
2.9.2.1 協定的功能 39
2.9.2.2 訊息類型 39
2.9.3 Session Description Protocol (SDP) 40
2.9.4 Real Time Streaming Protocol (RTSP) 41
2.9.4.1 協議指令 42
2.9.5 RTSP客戶端/伺服器端傳輸流程 45
2.10 H.264/MPEG-4 AVC 46
2.10.1 H.264位元流格式 46
2.11 JSON 50
2.12 MongoDB 53
2.12.2 BSON 55
2.13 Google Cloud Messaging (GCM) 55
2.13.1 架構概要 56
2.13.2 關鍵概念 57
2.13.3 生命週期流程 58
第三章 雲端智慧監控系統之設計 59
3.1 系統介紹 59
3.1.1 系統功能 59
3.1.1.1 訊息通知 59
3.1.1.2 即時串流 59
3.1.1.3 影片查詢 59
3.1.2 系統特色 60
3.1.3 系統架構與流程 61
3.1.3.1 雲端智慧監控系統架構 61
3.1.3.1 前端智慧監控裝置 62
3.1.3.1.1 智慧監控裝置軟體架構 62
3.1.3.1.2 智慧監控裝置架構 63
3.1.3.1.2.1 影像串流訂閱服務 64
3.1.3.1.2.2 行動偵測服務 64
3.1.3.1.2.3 影片紀錄服務 65
3.1.3.1.2.4 影片上傳服務 65
3.1.3.1.2.5 影片串流服務 65
3.1.3.1.2.6 訊息服務 65
3.1.3.2 後端雲端服務 66
3.1.3.2.1 影片儲存伺服器 66
3.1.3.2.2 訊息伺服器 67
3.1.3.2.2.1 手機端與訊息伺服器連線架構 67
3.1.3.2.2.2 訊息伺服器系統架構 68
3.1.3.2.2.3 裝置伺服器訊息格式 70
3.1.3.2.2.4 Gcm自定義伺服器訊息格式 71
3.1.3.2.3 動態即時串流伺服器 78
3.1.3.2.3.1 裝置端與伺服器連線流程 78
3.1.3.2.3.2 裝置端與伺服器間訊息格式 79
3.2 系統開發需求 82
3.2.1 硬體需求 82
3.2.2 軟體需求 83
第四章 雲端智慧監控系統之實作 85
4.1 前端智慧監控裝置 85
4.1.1 同步佇列 85
4.1.2 V4l2影像來源 86
4.1.3 影像訂閱者 88
4.1.4 影像上傳服務 88
4.1.5 行動偵測服務 91
4.1.6 影片錄製服務 93
4.1.7 訊息服務 96
4.1.8 串流服務 99
4.1.9 監控攝影機 103
4.1.10 監控裝置 105
4.2 後端雲端服務 107
4.2.1 訊息伺服器 107
4.2.2 動態即時串流伺服器 109
4.2.2.1 RTP埠號產生器 109
4.2.2.2 H264串流接收端 110
4.2.2.3 影片串流 114
4.2.2.4 裝置 114
4.2.2.5 裝置管理員 115
4.2.2.6 DRTSP伺服器 116
4.2.2.6.1 啟動Live555伺服器 116
4.2.2.6.2 初始化裝置 117
4.2.2.6.3 加入會話 120
4.2.2.6.4 移除會話 122
4.2.2.6.5 離線裝置 123
第五章 系統成果展示 124
5.1 智慧監控裝置 124
5.2 影片儲存伺服器 128
5.3 動態串流伺服器 128
5.4 訊息伺服器 131
5.5 手機應用程式 134
第六章 未來展望 138
6.1 Motion Vector 140
6.2 Fast Compressed Domain Algorithm 142
6.2.1 演算法運作 142
6.2.1.2 Parsing 143
6.2.1.3 Pre-processing 143
6.2.1.4 信任度(Confidence)測量 144
6.2.1.5 信任度計算 144
第七章 結論 146
參考文獻 147
附錄A 150
參考文獻 References
1. Raspberry Pi - Wikipedia, the free encyclopedia. [cited 2015 July]; Available from: https://en.wikipedia.org/wiki/Raspberry_Pi.
2. Raspberry Pi - Teach, Learn, and Make with Raspberry Pi. [cited 2015 June]; Available from: https://www.raspberrypi.org/.
3. Collins, R.T., A System for Video Surveillance and Monitoring. 2000: Carnegie Mellon University, the Robotics Institute.
4. Martínez-Martín, E. and Á.P. del Pobil, Motion Detection in Static Backgrounds, in Robust Motion Detection in Real-Life Scenarios. 2012, Springer London: London. p. 5-42.
5. simple motion detection with OpenCV - Cédric Verstraeten. [cited 2015 August]; Available from: https://blog.cedric.ws/opencv-simple-motion-detection.
6. OpenCV | OpenCV. [cited 2015 November]; Available from: http://opencv.org/about.html.
7. FFmpeg - Wikipedia, the free encyclopedia. [cited 2015 November]; Available from: https://en.wikipedia.org/wiki/FFmpeg.
8. 朱俊瑋, 設計一個快速儲存與同步資料之高效能雲端儲存介面, in 資訊工程學系研究所. 2015, 國立中山大學. p. 89.
9. Cloud Messaging - Google Developers. [cited 2016 April]; Available from: https://developers.google.com/cloud-messaging/?hl=zh-tw.
10. LIVE555 Streaming Media - LIVE555.COM. [cited 2015 November]; Available from: http://www.live555.com/liveMedia/.
11. Logitech HD Pro Webcam C920 – MyLabWiki. [cited 2015 June]; Available from: http://wiki.oz9aec.net/index.php/Logitech_HD_Pro_Webcam_C920.
12. Beaglebone Images, Video and OpenCV - derekmolloy.ie. [cited 2015 June]; Available from: http://derekmolloy.ie/beaglebone-images-video-and-opencv/.
13. PCM Audio | Part 1: What is PCM? | yPass.net Blog. [cited 2015 June]; Available from: http://www.ypass.net/blog/2010/01/pcm-audio-part-1-what-is-pcm/.
14. Capture/Webcam - FFmpeg. [cited 2015 June]; Available from: https://trac.ffmpeg.org/wiki/Capture/Webcam.
15. Capture/ALSA - FFmpeg. [cited 2015 June]; Available from: https://trac.ffmpeg.org/wiki/Capture/ALSA.
16. Raspbian | Raspberry Pi台灣樹莓派. [cited 2015 June]; Available from: http://www.raspberrypi.com.tw/tag/raspbian/.
17. Raspbian: FrontPage. [cited 2015 June]; Available from: https://www.raspbian.org.
18. Raspbian:世界上“最小的”操作系統是怎樣練成的? - PingWest. [cited 2015 June]; Available from: http://www.pingwest.com/building-the-raspbian-os/.
19. The Video4Linux2 API: an introduction [LWN.net]. [cited 2015 October]; Available from: http://lwn.net/Articles/203924/.
20. Video4Linux - Wikipedia, the free encyclopedia. [cited 2015 October]; Available from: https://en.wikipedia.org/wiki/Video4Linux.
21. Chen, C. and X. Zhang, Moving Vehicle Detection Based on Union of Three-Frame Difference, in Advances in Electronic Engineering, Communication and Management Vol.2: Proceedings of 2011 International Conference on Electronic Engineering, Communication and Management (EECM 2011), held on December 24–25, 2011, Beijing, China, D. Jin and S. Lin, Editors. 2012, Springer Berlin Heidelberg: Berlin, Heidelberg. p. 459-464.
22. RTP - Wikipedia. [cited 2015 November]; Available from: https://en.wikipedia.org/wiki/Real-time_Transport_Protocol.
23. RTP Control Protocol - Wikipedia, the free encyclopedia. [cited 2015 November]; Available from: https://en.wikipedia.org/wiki/RTP_Control_Protocol.
24. Session Description Protocol - Wikipedia, the free encyclopedia. [cited 2015 November]; Available from: https://en.wikipedia.org/wiki/Session_Description_Protocol.
25. RTSP - Wikipedia. [cited 2015 November]; Available from: https://en.wikipedia.org/wiki/Real_Time_Streaming_Protocol.
26. Exploring H.264. Part 2: H.264 Bitstream format | Gentle Logic. [cited 2015 December]; Available from: http://gentlelogic.blogspot.tw/2011/11/exploring-h264-part-2-h264-bitstream.html.
27. H.264/MPEG-4 AVC - Wikipedia, the free encyclopedia. 2015]; December]. Available from: https://en.wikipedia.org/wiki/H.264/MPEG-4_AVC.
28. H.264先進視訊編解碼標準. [cited 2015 December]; Available from: http://www.tvro.com.tw/main5/maimtxt/H.264報導-工研院.htm.
29. 視訊壓縮圖像類型- 维基百科,自由的百科全书. [cited 2015 December]; Available from: https://zh.wikipedia.org/wiki/視訊壓縮圖像類型.
30. JSON. [cited 2015 December]; Available from: http://www.json.org/.
31. 蕭銘傳, 研究以Linux容器為基礎之平台即服務雲端作業系統, in 資訊工程學系研究所. 2014, 國立中山大學. p. 119.
32. BSON - Binary JSON. [cited 2015 December]; Available from: http://bsonspec.org/.
33. Szczerba, K., et al. Fast Compressed Domain Motion Detection in H.264 Video Streams for Video Surveillance Applications. in Advanced Video and Signal Based Surveillance, 2009. AVSS '09. Sixth IEEE International Conference on. 2009.
34. Motion estimation - Wikipedia, the free encyclopedia. [cited 2016 August]; Available from: https://en.wikipedia.org/wiki/Motion_estimation.
35. Motion vector - Wikipedia, the free encyclopedia. [cited 2016 August]; Available from: https://en.wikipedia.org/wiki/Motion_vector.
36. Motion compensation - Wikipedia, the free encyclopedia. [cited 2016 August]; Available from: https://en.wikipedia.org/wiki/Motion_compensation.
37. H.264/AVC 技術與應用簡介 [cited 2016 August]; Available from: http://www.cc.ntut.edu.tw/~shyang/Journal Papers/H264_AVC.pdf.
38. Radke, R.J., et al., Image change detection algorithms: a systematic survey. IEEE Transactions on Image Processing, 2005. 14(3): p. 294-307.
電子全文 Fulltext
本電子全文僅授權使用者為學術研究之目的,進行個人非營利性質之檢索、閱讀、列印。請遵守中華民國著作權法之相關規定,切勿任意重製、散佈、改作、轉貼、播送,以免觸法。
論文使用權限 Thesis access permission:自定論文開放時間 user define
開放時間 Available:
校內 Campus: 已公開 available
校外 Off-campus: 已公開 available


紙本論文 Printed copies
紙本論文的公開資訊在102學年度以後相對較為完整。如果需要查詢101學年度以前的紙本論文公開資訊,請聯繫圖資處紙本論文服務櫃台。如有不便之處敬請見諒。
開放時間 available 已公開 available

QR Code