利用 CmuCam2 攝影機追蹤色球
作者:劉孝忠 (2008-09-29)
本文介紹Carnegie Mellon University Robotics Institute 生產之CMUcam2,並用CMUcam2來追蹤色球。
圖1 硬體架構圖
一、CMUcam2簡介
圖2 CMUcam2
二、CMUcam2資料封包(Data Packet)
Type T data packet format:
This is the return packet from a color tracking or frame differencing command.
mx - The middle of mass x value
my - The middle of mass y value
x1 - The left most corner’s x value
y1 - The left most corner’s y value
x2 - The right most corner’s x value
y2 -The right most corner’s y value
pixels –Number of Pixels in the tracked region, scaled and capped at 255: (pixels+4)/8
confidence -The (# of pixels / area)*256 of the bounded rectangle and capped at 255
T mx my x1 y1 x2 y2 pixels confidence\r
Type S data packet format:
This is a statistic packet that gives information about the camera’s view
Rmean - the mean Red or Cr (approximates r-g) value in the current window
Gmean - the mean Green or Y (approximates intensity) value found in the current window
Bmean - the mean Blue or Cb (approximates b-g) found in the current window
Rdeviation - the *deviation of red or Cr found in the current window
Gdeviation- the *deviation of green or Y found in the current window
Bdeviation- the *deviation of blue or Cb found in the current window
*deviation: The mean of the absolute difference between the pixels and the region mean.
S Rmean Gmean Bmean Rdeviation Gdeviation Bdeviation \r
三、CMUcam2命令(Command)
The camera is controlled using serial communication. All commands are sent using visible ASCII characters.
四、CMUcam2硬體接線及Baudrate設定
圖3硬體接線
圖4 Baudrate設定