本實作透過 Printer 8255 卡做為連接個人電腦與遊戲機台之橋梁,以上述提出的利 用角點偵測加速之人臉追蹤方法,判斷人臉之方向位置,再經由 PC 端透過 Printer port 傳送硬體控制碼到 8255 卡,再由 8255 卡傳送一 5V 電壓訊號到遊戲機台相對應之腳位,
以達到利用人臉追蹤技術來控制遊戲機台之上下左右方向鍵的功能,基於遊戲機台屬於 廠商之商業機密,因此本文不多做介紹。
我們將 Printer 8255 卡的第一顆 8255 IC 之 PA port 裡的 PA2 腳位設定成上方向鍵,
其硬體控制碼為:
JSWriteChar(0x378, 0x10);
JSWriteChar(0x37A, 0xF);
JSWriteChar(0x37A, 0x7);
JSWriteChar(0x378, 0xff-0x04);
JSWriteChar(0x37A, 0x6);
JSWriteChar(0x37A, 0x7);
將 PA3 腳位設定成下方向鍵,其硬體控制碼為:
JSWriteChar(0x378, 0x10);
JSWriteChar(0x37A, 0xF);
將 PA4 腳位設定成左方向鍵,其硬體控制碼為:
JSWriteChar(0x378, 0x10);
JSWriteChar(0x37A, 0xF);
JSWriteChar(0x37A, 0x7);
JSWriteChar(0x378, 0xff-0x10);
JSWriteChar(0x37A, 0x6);
JSWriteChar(0x37A, 0x7);
將 PA5 腳位設定成左方向鍵,其硬體控制碼為:
JSWriteChar(0x378, 0x10);
JSWriteChar(0x37A, 0xF);
JSWriteChar(0x37A, 0x7);
JSWriteChar(0x378, 0xff-0x20);
JSWriteChar(0x37A, 0x6);
JSWriteChar(0x37A, 0x7);
(a)
(b)
(c)
(d)
圖 6.3 實作結果圖
上圖 6.3 是以遊戲機台中的小靈精遊戲為例,(a)為人臉向左移動控制小精靈往左移 動,(b)為人臉向下移動控制小精靈往下移動,(c)為人臉向右移動控制小精靈往右移動,
(d)為人臉向上移動控制小精靈往上移動。
第 7 章 結論
本研究主要是人工方式取得人臉區塊,再利用區塊比對法來進行人臉追蹤,而區塊 比對法主要是比對區塊間的像素差異度,差異度越小代表區塊間越相似,而本研究起初 以全域搜尋法做為區塊比對法的搜尋演算法,雖然比對效果最為精準但也最為費時,不 適合用於即時追蹤上,因此本文在第四章提出來直線運動預測向量法,利用前兩張 frame 的人臉區塊位置,來預測目前 frame 人臉區塊的位置,藉由縮小 search window 的大小,
以減少比對次數,將 FPS 提高到平均約 23 張 frame 上下,達到即時追蹤的效果,但在 人臉移動過快時會有追丟的情況發生,所以在第五章又加入了 KLT 角點偵測,取代原 本的全域搜尋法,只針對偵測出角點附近的區域做比對,此方法可以將 FPS 提高到平均 約 30 張 frame 上下,來防止因為人臉移動太快而產生追丟的情況。
由以上實驗結果可發現本文提出的人臉追蹤方法,雖然可以在單純背景下有良好的 追蹤效果,但在背景較複雜的情況下,追蹤框有一定機率會被較深色的背景吸引,導致 追蹤失敗,並且在光源變化較明顯處也會影響追蹤效果,因此未來可以朝這兩個方向改 進。
參考文獻
[1] J. Tu, H. Tao, and T. Huang, “Face as mouse through visual face tracking,” Computer Vision and Image Understanding, Vol. 108, No.1, pp. 35-40, 2007.
[2] H. S. Lee and D. Kim, “Robust face tracking by integration of two separate trackers: Skin color and facial shape,” Pattern Recognition, Vol. 40, No. 11, pp. 3225-3235, 2007.
[3] C. Küblbeck and A. Ernst, “Face detection and tracking in video sequences using the modified census transformation,” Image and Vision Computing, Vol. 24, No. 6, pp.
564-572, 2006.
[4] 王健宇,「可變形樣板於即時人臉追蹤系統之應用」,國立中山大學機械與機電工程
[7] M. Flierl and B. Girod, “Video coding with motion-compensated lifted wavelet transforms,” Signal Processing: Image Communication, Vol. 19, No. 7, pp. 561-575, 2004.
[8] D. Beymer, P. McLauchlan, B. Coifman, and J. Malik, “A real-time computer vision system for measuring traffic parameters,” Proceedings of IEEE Computer Society Conference on Computer Vision and Pattern Recognition, pp. 495-501, 1997.
[9] M. Greiffenhagen, V. Ramesh, D. Comaniciu, and H. Niemann, “Statistical modeling and performance characterization of a real-time dual camera surveillance system,”
Proceedings of IEEE Conference on Computer Vision and Pattern Recognition, Vol. 2, pp.
335-342, 2000.
[10] Y. B. Lee, B. J. You, and S. W. Lee, “A real-time color-based object tracking robust to irregular illumination variations,” Proceedings of IEEE International Conference on Robotics and Automation, Vol. 2, pp. 1659-1664, 2001.
[11] C. Lerdsudwichai and M. A. Mottaleb, “Algorithm for multiple faces tracking,”
2002.
[13] A. M. Baumberg and D. C. Hogg, “An efficient method for contour tracking using active shape models,” Proceedings of the IEEE Workshop on Motion of Nonrigid and Articulated Objects, pp. 194-199, 1994.
[14] I. Craw, H. Ellis, and J. Lishman, “Automatic extraction of face features,” Pattern Recognition Letters, Vol. 5, No. 2, pp. 183-187, 1987.
[15] P. Viola and M. Jones, “Rapid object detection using a boosted cascade of simple features,” Proceedings of IEEE Computer Society Conference on Computer Vision and Pattern Recognition, Vol. 1, pp. 511-518, 2001.
[16] S. Z. Li, Q. Zhang, H. Y. Shum, and H. J. Zhang, “FloatBoost learning for classification,”
Neural Information Processing Systems, 2002.
[17] S. A. El-Azim, I. Ismail, and H. A. El-Latiff, “An efficient object tracking technique using block-matching algorithm,” Proceedings of the Nineteenth National Radio Science Conference, pp. 427-433, 2002.
[18] S. Kappagantula and K. Rao, “Motion compensated interframe image prediction,” IEEE Transactions on Communications, Vol. 33, No. 9, pp. 1011-1015, 1985.
[19] J. Y. Tham, S. Ranganath, M. Ranganath, and A. A. Kassim, “A novel unrestricted center-biased diamond search algorithm for block motion estimation,” IEEE Transactions on Circuits and Systems for Video Technology, Vol. 8, No. 4, pp. 369-377, 1998.
[20] Z. Shan and M. Kai-Kuang, “A new diamond search algorithm for fast block-matching motion estimation,” IEEE Transactions on Image Processing, Vol. 9, No. 2, pp. 287-290, 2000.
[21] Z. Ce, L. Xiao, L. Chau, and P. Lai-Man, “Enhanced hexagonal search for fast block motion estimation,” IEEE Transactions on Circuits and Systems for Video Technology, Vol. 14, No. 11, pp. 1210-1214, 2004.
[22] H. P. Moravec, “Toward automatic visual obstacle avoidance,” Processing of the 5th International Joint Conference on Artificial Intelligence, pp. 584, 1977.
[23] C. Harris and M. Stephens, “A combined corner and edge detector,” Proceeding of the 4th Alvey Vision Conference, pp. 147-151, 1988.
[24] B. D. Lucas and T. Kanade, “An iterative image registration technique with an application to stereo vision,” Proceeding of the 4th International Joint Conference on Artificial Intelligence, pp. 674-679, 1981.
[25] S. M. Smith and J. M. Brady, “SUSAN: A new approach to low level image processing,”
International Journal of Computer Vision, Vol. 23, pp. 45-78, 1997.