自動化監控是近年來熱門的研究方向，由於監控人員無法永遠專注地監視攝影畫面，利用自動化監控來幫忙追蹤監視是必要的。但目前的監控系統是以固定式定點拍攝的攝影機為主要設備，由於攝影範圍有限，因而會有許多的死角，造成監視上的困難。因此，我們採用可旋轉式攝影機(Pan-Tilt-Zoom camera)，利用其可控制移轉的特性來增加監控視野。 本研究提出動態背景預測法來偵測並追蹤物體。當攝影機未移動時，利用背景相減找出移動物體並取出其特徵點，在攝影機追蹤移動時，採用光流運算得到移動物體的特徵點移動後的位置與背景移動向量，進而估計出當前的背景影像，再用動態背景補償的方式，防止預測誤差傳播擴散，最後採用分水嶺演算法得到物體更精確的輪廓，以控制攝影機完成追蹤。 當移動物體突然轉向或停止時，我們所提出的方法依然可以正確的追蹤物體，實驗結果證實我們所提出方式的可行性。 There are increasing demands to detect usual/unusual events in various environments nowadays. Deploying cameras in public/private areas to form a ubiquitous surveillance system is thought to be very helpful in ensuring safety of people in many aspects. However, as more and more cameras are being installed, it may become impractical and cumbersome to find available human resources to achieve effective surveillance. Advanced surveillance systems that can actively monitor an area/object of interest and automatically identify abnormal situations are considered to be a promising solution. The advanced surveillance systems rely on analyzing the visual data recorded by the cameras to determine if unusual events happen. The issue of object tracking in video frames is thus very important and needs to be investigated thoroughly. In this research, we adopt Pan-Tilt-Zoom (PTZ) cameras in our surveillance environment and propose a novel detection and tracking algorithm for dynamic scene videos captured by a PTZ camera. In our system, we first use the static scene tracking algorithm to construct the background and then use the dynamic scene tracking algorithm when the camera starts moving. The optical flow approach is used to detect the background motion and then predict the current background image. The background subtraction is then applied to obtain the rough foreground regions. In order to better predict the next frame, we compensate the predicted background to prevent error propagation. Finally, the watershed algorithm is applied to obtain a more precise contour of the foreground object. The camera is controlled to move for tracking the object accordingly. Experimental results show the feasibility of the proposed system.