## 2 Proposed Vehicle Detection and Tracking System
### Headlight and Taillight Tracking
where \(A\) is the area of the bounding box enclosing the light region. \(S_{0}\) is used to determine the tracking state of newly detected vehicle lights in the incoming frame. It is assumed that the time interval between two consecutive frames is short (33 ms for 30 frames per second), such that the vehicle velocity does not change significantly. Therefore, the motion information is used to predict the position of an incoming vehicle light. For a vehicle light that has been tracked in at least two frames, its motion vector can be calculated as follows:  
\[ \begin{cases}vx_{i}^{t-1}=l(TL_{i}^{t-1})-l(TL_{i}^{t-2})\\ vy_{i}^{t-1}=t(TL_{i}^{t-1})-t(TL_{i}^{t-2})\end{cases}  \tag{6}\]  
The motion vector is equal to 0 when the vehicle light appears for the first and second times. Let \(\widehat{T}L_{i}^{t-1}\) denote the predicted position of the vehicle light tracker \(TL_{i}^{t-1}\) in the next frame:  
\[ \begin{cases}t(\widehat{T}\widehat{L}_{i}^{t-1})=t(TL_{i}^{t-1})+vy_{i}^{t-1} \\ l(\widehat{T}\widehat{L}_{i}^{t-1})=l(TL_{i}^{t-1})+vx_{i}^{t-1}\\ b(\widehat{T}\widehat{L}_{i}^{t-1})=b(TL_{i}^{t-1})+vy_{i}^{t-1}\\ r(\widehat{T}\widehat{L}_{i}^{t-1})=r(TL_{i}^{t-1})+vx_{i}^{t-1}\end{cases}  \tag{7}\]  
In the light tracking process, the vehicle light tracker might be in one of three possible states:  
1. **Update:** if a detected vehicle light \(L_{i}^{t}\in\mathbf{L^{t}}\) in the current frame \(t\) matches a predicted position \(\widehat{T}\widehat{L}_{j}^{t-1}\) of an existing tracker \(TL_{j}^{t-1}\in\mathbf{T}\mathbf{L^{t-1}}\) in the previous frame. Then, the tracker \(TL_{j}^{t}\) is associated with \(L_{i}^{t}\) and the tracker is added to the set of light trackers \(\mathbf{T}\mathbf{L^{t}}\) the in current frame. The matching condition is \[S_{0}(L_{i}^{t},\widehat{T}\widehat{L}_{j}^{t-1})>\tau_{m}\] (8) where \(\tau_{m}\) is a matching threshold for verifying whether \(L_{i}^{t}\) can be associated with \(TL_{j}^{t-1}\). The value of \(\tau_{m}\) is chosen experimentally as 0.2. 2. **Appear:** if a detected vehicle light \(L_{i}^{t}\in\mathbf{L^{t}}\) in the current frame \(t\) does not match any predicted positions \(\widehat{T}L_{j}^{t-1}\) of existing trackers \(TL_{j}^{t-1}\in\mathbf{T}\mathbf{L^{t-1}}\) in the previous frame. Then, a new light tracker is created and it is added to the set of light trackers \(\mathbf{T}\mathbf{L^{t}}\) in the current frame. 3. **Disappear:** if a predicted position \(\widehat{T}\widehat{L}_{j}^{t-1}\) of existing tracker \(TL_{j}^{t-1}\in\mathbf{T}\mathbf{L^{t-1}}\) cannot be matched by any newly detected vehicle light \(L_{i}^{t}\in\mathbf{L^{t}}\) in the current frame \(t\). Because the existing tracker may sometimes be temporarily occluded, the system keeps tracking this tracker in three consecutive frames. While the tracker \(TL_{j}^{t-1}\) has temporarily disappeared, its position is updated by using Equation (7). Otherwise, if the tracker \(TL_{j}^{t-1}\) cannot be matched for more than three consecutive frames, it is considered to have disappeared and is removed from the set of light trackers \(\mathbf{T}\mathbf{L^{t}}\).