• 沒有找到結果。

影像追蹤控制器設計

第四章 使用者影像追蹤

4.3 影像追蹤控制器設計

位置,所以在此要先對不同的影像資料進行整合(Image Date Fusion),分別為以 下三種情況:

情況2. 機器人只偵測到使用者人臉: 均濾波器(Mean Filter)來進行濾波,如(4-13)所示,對連續時間內的 n 筆輸入訊號 進行平均:

0 50 100 150 200 250 300

Degree of membership

Very Left Left Middle Right Very Right

圖 4-14 XU的歸屬函數

Degree of membership

Very Up UP Middle Down Very Down

圖 4-15 YU的歸屬函數

Degree of membership

Very Far Far Front Close Very Close

圖 4-16 DU的歸屬函數

DU 的設計是透過實驗來找出使用者距離機器人的關係,本論文希望機器人能與 使用者保持約 60 公分之安全距離,而此時人臉寬度為 55 左右,所以依此為標 準,將 DU分成五個等級,分別為使用者距離機器人很遠(Very Far)、使用者距離 機器人遠(Far)、使用者在機器人面前 (Front)、使用者距離機器人近(Close)、使 用者距離機器人很近(Very Close) ,如圖 4-16 所示。

影像追蹤控制器的輸出為機器人速度[ωm、ωtilt、Vm],其中ωm是機器人本體 的角速度,讓機器人可以修正自身的方向來轉向使用者,ωtilt是機器人頭部上下 俯仰之速度,讓機器人可以修正頭部方向來注視著使用者,Vm 機器人本體的線 速度,讓機器人可以前進或後退。在輸出端的歸屬函數(Output Membership Function)設計上,將ωm分成五個等級,分別為快速向左轉(Turn Left Fast)、向左 轉(Turn Left)、停止(Stop)、向右轉(Turn Right)、快速向右轉(Turn Right Fast),如 圖 4-17 所示,當使用者在畫面的邊緣時,機器人能以設定的最大轉速±0.785 rad/sec 來快速轉向使用者。同樣的,將ωtilt分成五個等級,分別為快速向上轉(Turn Up Fast)、向上轉(Turn Up)、停止(Stop)、向下轉(Turn Down)、快速向下轉(Turn Down Fast),如圖 4-18 所示,設定最大轉速為±0.175 rad/sec 來快速轉向使用者。

最後,將 Vm也分成五個等級,分別為快速後退(Move Backward Fast)、後退(Move Backward)、停止(Stop)、前進(Move Forward)、快速前進(Move Forward Fast),如 圖 4-19 所示,根據不同的人臉寬度,來決定機器人的線速度,最大線速度設定 為±30 cm/sec。

透過模糊化,便能將濾波後的輸入訊號[XU、YU、DU]轉換到相應歸屬函數 值A1(XU)、A2(YU)、A3(DU),然後再將歸屬值送到推論引擎,搭配模糊規則便 可計算出所相應的機器人速度。而其中模糊規則設計如下:

If the XU is on the very left side of the screen, then the robot turns right fast.

If the XU is on the left side of the screen, then the robot turns right.

If the XU is on the middle side of the screen, then the robot stops.

If the XU is on the very right side of the screen, then the robot turns left fast.

If the YU is on the very up side of the screen, then the robot’s head turns up fast.

If the YU is on the up side of the screen, then the robot’s head turns up.

If the YU is on the middle side of the screen, then the robot’s head stops.

If the YU is on the down side of the screen, then the robot’s head turns down.

If the YU is on the very down side of the screen, then the robot’s head turns down fast.

If the DU is very close from the robot, then the robot moves backward fast.

If the DU is close from the robot, then the robot moves backward.

If the DU is in the front of the robot, then the robot stops.

If the DU is far from the robot, then the robot moves forward.

If the DU is very far from the robot, then the robot moves forward fast.

在解糢糊化方面,一樣使用 Minimum Inference Engine 來計算模糊輸出值。然後 透過 Center of Area 來解模糊化,計算出相應的機器人速度輸出[ωm、ωtilt、Vm]。

最 後 將 機 器 人 速 度 轉 換 到 機 器 人 左 右 兩 輪 與 頭 部 馬 達 之 速 度 (Kinematics Transformation),如(4-14)~(4-16)所示,如此機器人就能根據使用者的影像資訊來 追蹤使用者,而完整的使用者影像追蹤流程圖如下圖 4-20 所示。

2 V E

Vml = m + ⋅ωm (4-14)

2 V E

Vmr = m − ⋅ωm (4-15)

tilt

Vtilt =

ω

(4-16) 其中

Vml、Vmr為機器人左輪、右輪之速度,單位 cm/sec Vtilt為機器人頭部上下俯仰之速度,單位 cm/sec

ωm、Vm為影像追蹤控制器所輸出的機器人本體角速度、線速度,單位 cm/sec ωtilt為影像追蹤控制器所輸出的機器人頭部上下俯仰之速度,單位 cm/sec E 為機器人兩輪之間的距離,單位 cm

-0.6 -0.4 -0.2 0 0.2 0.4 0.6

Degree of membership

Turn Left Fast Turn Left Stop Turn Right Turn Right Fast

圖 4-17 ωm的歸屬函數

Degree of membership

Turn Up Fast Turn Up Stop Turn Down Turn Down Fast

圖 4-18 ωtilt的歸屬函數

Degree of membership

Move Backward Fast Move Backward Stop Move Forward Move Forward Fas

圖 4-19 Vm的歸屬函數

圖 4-20 使用者影像追蹤流程圖

4.4 結論與討論

本論文經由 Kinect 所提供的深度影像,使用了使用者產生器來偵測使用者 人形,並且計算使用者在畫面中的人型質心座標。然後經由 Kinect 所提供的彩 色影像,使用了 Haar-Like Features 人臉偵測來找出畫面中可能為人臉的影像區 域,接著使用人臉膚色密度來找出真正為人臉的影像區域,並且計算使用者人臉 的中心座標與人臉寬度。將這些影像資訊進行整合後,透過本論文所設計的影像 追蹤控制器,讓機器人可以修正自身方向,朝向使用者前進,並且在適當的距離 下,停在使用者面前,完成召喚任務。