隨著科技的發展,人們漸漸習慣使用更人性化的科技產品,講求方便、直覺且容易操作的軟硬體設備。然而觸控式螢幕的日新月異,逐漸取代一般常見的輸入裝置,例如:滑鼠、鍵盤等等。除此之外,也開始有人用網路攝影機取像,並且以電腦視覺的方法分析,形成另一種的輸入裝置。 本論文提出一個以單一攝影機實現單指虛擬鍵盤之功能的系統,目的是希望能夠以網路攝影機取得並分析使用者輸入的行為,進而作為一種新式的輸入方式。首先我們利用霍夫曼直線偵測建立並且定位虛擬鍵盤,再利用背景相減取得手指和手指陰影的形狀,並將兩者分開以取得手指指尖移動的軌跡、方向、速度與手指陰影指尖的距離變化這幾項資訊來做一系列的分析和觸碰偵測;觸碰偵測部分我們分成了兩大類,第一類是手指陰影存在的情況,利用的是觸碰時指尖與手指陰影指尖距離變化的特性,第二類則是手指陰影不存在的情況,使用的方法是觀察指尖移動軌跡向量的變化和觸碰時指尖停留的特性來做觸碰偵測,最後再進行觸碰驗證與結果輸出。 在實驗部分,我們模擬了很多不同使用者的觸碰行為在數種不同的距離和不同的型式的虛擬鍵盤。實驗結果顯示,本論文提出的方法可以準確且有效地偵測不同使用者的輸入方式。 Due to the fast development of computer and video technologies, people are used to more humanized and convenient products. The touch screens are replacing other traditional input devices such as keyboards and mouse. Researchers have also been devoted themselves to designing new interfaces. Interfaces using webcams are one of the emerging interfaces. This thesis presents a method to detect touches on a virtual keyboard using a single camera. We use a webcam to analyze fingertip touching actions. Firstly, we use hough transform to locate the virtual keyboard. Then, we separate the finger and the shadow to get the information such as trajectory, direction, speed and the distance between the fingertip and the shadow. Afterwards, we consider touches under two different conditions when shadow exists and shadow does not exist. We use the distance between the finger and the shadow to detect touches when shadow exists, and use the variation of trajectory and the time property to detect touches when shadow does not exist. Finally, we validate these touches by their locations and the frequency of touches. Experimental results show that the proposed method provides a feasible way to detect touches on several kinds of the virtual keyboards with various camera distance settings. Moreover, the proposed method can be used in real-time applications.