## 3 Proposed Methods
### Taillight Pairing
#### 3.3.2 Features for Taillight Pairing  
We consider three features for constructing the feature vector _pairVec_. These features are horizontal distance (HD), vertical distance (VD), and normalized symmetrical cross-correlation (NSCC). The value of each of them is within the range [0, 1] to simplify the classification. The explanation of each feature is presented as below:  
1. **HD**: The horizontal coordinates difference between \(T_{i}\) and \(T_{j}\). Initially, a normalized value \(\overline{x_{i}^{T}}\) of the horizontal coordinates \(x_{i}^{T}\) of the taillight \(T_{i}\), and a normalized value \(\overline{x_{j}^{T}}\) of the horizontal coordinates \(x_{j}^{T}\) of the taillight \(T_{j}\) are computed as follows, given that \(W_{T}\) is the image width:  
Figure 21: Taillight pairing procedure.  
\[\begin{cases}\overline{x_{i}^{T}}=\dfrac{x_{i}^{T}}{W_{T}}\\ \overline{x_{j}^{T}}=\dfrac{x_{j}^{T}}{W_{T}}\end{cases}, \tag{25}\]  
HD is defined as the difference between \(\overline{x_{i}^{T}}\) and \(\overline{x_{j}^{T}}\). Therefore, it can be calculated by the following equation, where \(\mid v\mid\) denotes the absolute value of \(v\). \[HD=\mid\overline{x_{i}^{T}}-\overline{x_{j}^{T}}\mid,\] (26) The two taillights that potentially belong to the same vehicle must have an HD value that is not too large or too small. Moreover, the value of HD also depends on the position of the taillights compared to the camera. HD increases when the taillight approaches the camera, and otherwise. The sufficient range for HD will be determined after constructing the pairing classifier.
2. **VD**: The difference between the two vertical coordinates \(y_{i}^{T}\) and \(y_{j}^{T}\) of \(T_{i}\) and \(T_{j}\). At first, these normalized values \(\overline{y_{i}^{T}}\) and \(\overline{y_{j}^{T}}\) are calculated as below, given that \(H_{T}\) is the image height: \[\begin{cases}\overline{y_{i}^{T}}=\dfrac{y_{i}^{T}}{H_{T}}\\ \overline{y_{j}^{T}}=\dfrac{y_{j}^{T}}{H_{T}}\end{cases},\] (27) After that, VD is given by \[VD=\mid\overline{y_{i}^{T}}-\overline{y_{j}^{T}}\mid,\] (28) Similar to HD, the value of VD for the valid taillight pair must lie within a certain range. However, a sufficient range for VD cannot be known until the pairing classifier is constructed. Figure 22 below illustrates how to determine HD and VD.
3. **NSCC**: It estimates the symmetrical characteristics in common for the left and right taillight. Denote that \(w_{i}^{T}\) and \(h_{i}^{T}\) are the width and height of \(T_{i}\), and \(w_{j}^{T}\) and \(h_{j}^{T}\) are the width and height of \(T_{j}\). After converting \(T_{i}\) and \(T_{j}\) into grayscale matrices, the two matrices \(L\) and \(R\) are obtained by applying mean subtraction on \(T_{i}\) and the horizontal flip of \(T_{j}\), respectively. Each element of \(L\) and \(R\) is determined by Equation (29).  
Figure 22: Horizontal distance (HD) and vertical distance (VD) determination.  
\[\begin{cases}L(k,l)=T_{i}(k,l)-\mathbf{mean}(T_{i}),&1\leq k\leq w_{i}^{T},\\ &1\leq l\leq h_{i}^{T},\\ R(m,n)=T_{j}(m,h_{j}-1-n)-\mathbf{mean}(T_{j}),&1\leq m\leq w_{j}^{T},\\ &1\leq n\leq h_{j}^{T},\end{cases}, \tag{29}\]  
The cross-correlation matrix \(B\) and NSCC are then determined as below:  
\[B(k,l)=\sum_{w=1}^{w_{l}^{T}}\sum_{h=1}^{h_{i}^{T}}L(w,h)R(w-k,h-l), -(w_{j}^{T}-1)\leq k\leq w_{i}^{T}-1, \tag{30}\] \[NSCC=\frac{\mathbf{max}(B)}{\|L\|\|R\|}, \tag{31}\]  
Similarly to the feature NCC from _matchVec_, the range of NSCC is \([0,1]\), wherein a higher value indicates a higher probability that the two taillights are symmetric regarding each other.