本篇論文主要展示一個針對高速公路路旁的高架攝影機的影像來做車輛偵測、追蹤與計數的即時系統,主要方法分成兩個階段: 第一個階段為車輛偵測,主要是用影像相減法,將目前影像與背景影像相減,在用二值化將相減影像的車輛與背景分割,再利用型態學(Morphology)的方式將破碎的車輛區塊連結起來,最後連結元件標號與填滿將記錄區塊與將內部完全填滿,使的區塊的形心更能代表區塊的中心點。 第二階段是利用連續兩個影像中區塊與區塊之間各自的特徵來做配對,若是區塊都配對成功,則可以利用連續影像中相同區塊之間的形心,依序連結就能畫出車輛的軌跡。 實驗結果不塞車時正確率能達到90%以上,每個畫面的平均執行時間最多為58.13ms小於影像最低執行時間66.66ms,故本系統是一個可行的即時系統。 This paper presents a real-time system of vehicle detection, tracking and counting. Image sequences are from the road side camera in the freeway. There are two main stages in this system. Stage 1. Vehicle detection. We use Image subtraction to show the difference between background and vehicle, then segment difference image to separated vehicle and background. Use Morphology to combine region which belong to the same vehicle. Connected component labeling and fill is to fill each region, and then region’s centroid can be more accuracy. Stage 2. In image sequences, each region in the image have difference feature. Use each region’s centroid, length, width and area to match region between two image sequences. If every region matches success, then we can use match region’s centroid to draw trajectory. In the Experimental result, if not traffic jams, accuracy can be more than 90%; each frame average execution time is less than 58.13 ms, lower than image need execution time 66.66ms. So this system is a workable and real-time system.