2013年6月15日 星期六

DIY - 智能小車:用 Microsoft Visual C++/CLI 編寫 Web Cam 程式步驟 (三十九)


DIY - 智能小車:用 Microsoft Visual C++/CLI 編寫 Web Cam 程式步驟 (三十九): 

除雷達圖像外,Web Cam 是智能小車不可缺少的設備,智能小車前方的環境,可以通過 USB WebCam 攝製影像,再通過 WiFi 傳送影像至主控制器,影像通過 AForge 庫,控制人員觀察現場環境影像,可以用主控制器控制智能小車。
 
Step by Step:
步驟 1:在 Visual Studio 2010 中建立 Visual C++/CLI Windows Form應用程式 
應用程式設定(名稱:03_CLI_AForge_ipcam)

▲ Visual Studio 2010 → 檔案 → 新增 → 專案
▲ 其他語言 → Visual C++ → CLR → Windows Form 應用程式
▲ 專案名稱(03_CLI_AForge_ipcam)→ 確定
步驟 2:點選 專案 → 參考 → AForge.Video.DirectShow.dll、AForge.Video.dll 和 AForge.Control.dll

▲ 專案 → 參考
▲ 加入新參考
▲ 瀏覽
▲ 選擇 AForge.Video.DirectShow.dll → 確定

顯示 AForge.Video.DirectShow.dll → 然後繼續加入 AForge.Video.dll和 AForge.Control.dll 

▲ 顯示 AForge.Video.DirectShow.dll、AForge.Video.dll 和 AForge.Control.dll → 確定
步驟 3:點選工具箱 → 選擇項目 → AForge.Control.dll

▲ 按工具箱
▲ 選擇工具箱 → 通用控制項 → 鼠標右鍵選擇 → 選擇項目
▲ 瀏覽
▲ 選擇 AForge.Conrol.dll → 確定 → 確定
▲ 工具箱出現了AForge的控制項
步驟 4:點選工具箱 → 放置不同的控制項

▲ 放置不同的控制項在 Form1 內
  1. Button1 – System.Windows.Forms.Button
  2. MainForm – System.Windows.Forms.Form
  3. mainPanel – System.Windows.Forms.Panel
  4. openFileDialog – System.Windows.Froms.OpenFileDialog
  5. statusStrip – System.Windows.From.StatusStrip
  6. timer – System.Windows.Timer
  7. videoSourcePlayer – Afroge.Controls.VideoSourcePlayer
▲ 控制項
步驟 5:程式碼


▲ 按鼠標右鍵 → 檢視程式碼 (F7)
▲ 鍵入程式碼
步驟 6:偵錯

▲ 偵錯 → 開始偵錯(F5)
2013年6月15日 天氣報告
氣溫:26.6 度 @ 22:20
相對濕度:百分之97%
天氣:雨

沒有留言:

張貼留言