## 2 Stereo-Vision-Based Nighttime V2V Positioning  
A stereo-vision-based V2V positioning process in nighttime scenarios includes five stages. In stage (**1**), the proposed taillight detection method is applied to locate the region and pixel coordinates of each taillight in each image. In stage (**2**), a stereo matching method is applied to determine which taillight detected from the left image corresponds to which taillight detected from the right image; and a pairing method in stage (**3**) is to associate every pair of taillights that belong to the same vehicle on each image. When the pixel coordinates of each taillight in the left and right images have been determined, the world coordinates of this taillight can be calculated in stage (**4**). Finally, given the world coordinates of each pair of taillights, the world coordinates of the corresponding vehicle are estimated in stage (**5**). An overview of this process is presented in Figure 1.  
In this study, our contribution includes three proposed methods for the first three stages from (**1**) to (**3**). Therefore, they will be described in detail in the next section. Besides, the intuition behind stages (**4**) and (**5**) is explained as follows:  
In stage (**4**), the stereo triangulation approach [27] is utilized to determine the world coordinates of each detected taillight, given an assumption that the two cameras capture the images simultaneously. We denote \(P(X,Y,Z)\) as the world coordinates of the taillight \(P\); \(O_{L}(u_{L},v_{L})\) and \(O_{R}(u_{R},v_{R})\), respectively, as the pixel coordinates of the left and right cameras' optical centers; and \(p_{L}(x_{L},y_{L})\) and \(p_{R}(x_{R},y_{R})\) as the pixel coordinates of \(P\) in the left and right images. Additionally, two cameras have the same horizontal focal length \(f_{x}\) and vertical focal length \(f_{y}\), and the camera baseline is \(b\). The stereo triangulation approach for taillight positioning is illustrated in Figure 2.  
Figure 1: Overview of the stereo-vision-based nighttime V2V positioning process.  
When considering two similar triangles, \(\Delta Pp_{L}p_{R}\) and \(\Delta PO_{L}O_{R}\), the Oz-axis value \(Z\) of the taillight \(P\) can be calculated using the following equations, given that all the mentioned coordinates are already known:  
\[\frac{p_{L}p_{R}}{O_{L}O_{R}}=\frac{b-x_{L}+x_{R}}{b}=\frac{Z-f_{x}}{Z}, \tag{1}\]  
\[\implies Z=\frac{f_{x}b}{x_{L}-x_{R}}, \tag{2}\]  
After calculating \(Z\), the two remaining values, \(X\) and \(Y\), of the world coordinates of \(P\) can be identified:  
\[\begin{cases}X=\frac{(x_{L}-u_{L})Z}{f_{x}}\\ Y=\frac{(y_{L}-v_{L})Z}{f_{y}}\end{cases}, \tag{3}\]  
In stage (5), we suppose that \(V\) is the midpoint of the line segment that connects the left taillight \(L\) and right taillight \(R\) of the vehicle. The world coordinates of \(V\) can be considered as the position of the vehicle, as illustrated in Figure 3.  
Figure 3: Estimate the front vehicle’s world coordinates based on its taillight pair.  
Figure 2: Stereo triangulation approach for estimating the taillight’s world coordinate.  
Once the world coordinates of the left taillight \(L\) and right taillight \(R\) have been determined as \(P_{L}(X_{L},Y_{L},Z_{L})\) and \(P_{R}(X_{R},Y_{R},Z_{R})\), respectively, the world coordinates \(V(X_{V},Y_{V},Z_{V})\) of the front vehicle are given by:  
\[\begin{cases}X_{V}=\dfrac{X_{L}+X_{R}}{2}\\ Y_{V}=\dfrac{Y_{L}+Y_{R}}{2}\\ Z_{V}=\dfrac{Z_{L}+Z_{R}}{2}\end{cases}. \tag{4}\]