# Vehicle Distance Measurement Method of Two-Way Two-Lane Roads Based on Monocular Vision
## 2 Methods
### Establishment of Vehicle Distance Measurement Model
#### 2.2.4 Improved Geometric Ranging Method  
Although the traditional geometric ranging method is simple and easy to implement, it only considers the pitch angle of the camera and ignores the roll angle of the camera, that is, the angle between the Y axis of the camera's imaging plane and the vertical line of the ground. However, the manual installation will inevitably lead to camera inclination in multiple dimensions, so the traditional geometric ranging method cannot meet the actual situation. It can be seen from Equation (7) that the distance \(d\) is related to the position of the feature point of the vehicle on the imaging plane. Therefore, a model of the camera's imaging plane when the camera has a roll angle is established to observe the change in the position of the feature point of the vehicle, as shown in Figure 6.  
Figure 5: Model of traditional geometric ranging method. Figure 6a shows the situation when the camera produces a left deflection angle \(\theta\); that is, the camera rotates \(\theta\) counterclockwise around the optical axis. The rectangular O\({}_{0}\)FGH is the image plane before the camera rotates, and its coordinate system is UO\({}_{0}\)V. The rectangular O\({}_{0}\)\({}^{\prime}\)BCD is the image plane after the camera rotates, and its coordinate system is U\({}^{\prime}\)O\({}_{0}\)\({}^{\prime}\)V\({}^{\prime}\). O\({}_{1}\) is the center point of the image plane, and its coordinate is (\(u_{0}\), \(v_{0}\)); P is the imaging position of the feature point of the vehicle on the image plane, and its coordinates on the plane O\({}_{0}\)FGH and the plane O\({}_{0}\)\({}^{\prime}\)BCD are respectively (\(u_{p}\), \(v_{p}\)) and (\(u_{p}\)\({}^{\prime}\), \(v_{p}\)\({}^{\prime}\)). Perpendicular lines of O\({}_{0}\)\({}^{\prime}\)B passing through P intersect with the extension line of O\({}_{0}\)F at I. Perpendicular lines of O\({}_{0}\)F passing through P intersect with O\({}_{0}\)F at K. Perpendicular lines of O\({}_{0}\)\({}^{\prime}\)D passing through P intersect with O\({}_{0}\)\({}^{\prime}\)D at Z. Perpendicular lines of O\({}_{0}\)H passing through P intersect with O\({}_{0}\)H at R. Hence, the length of KP is \(v_{p}\), the length of JP is \(v_{p}\)\({}^{\prime}\), the length of RP is \(u_{p}\), and the length of ZP is \(u_{p}\)\({}^{\prime}\). According to the principles of plane geometry, the following formula can be obtained:  
For \(\triangle\)PKI and \(\triangle\)JJQ, it can be obtained from the geometric relationship:  
\[l_{KP}=\left(l_{JP}+l_{IJ}\right)\times\cos\theta, \tag{8}\]  
\[l_{IJ}=\left(l_{JN}+l_{NQ}\right)\times\tan\theta, \tag{9}\]  
\[l_{JN}=l_{O_{0}^{\prime}N}-l_{O_{0}^{\prime}I}, \tag{10}\]  
For the \(\triangle\)MNQ, it can be obtained from the geometric relationship:  
\[l_{NQ}=\left(l_{MO_{1}}-l_{NO_{1}}\right)/\tan\theta, \tag{11}\]  
\[l_{MO_{1}}=l_{LO_{1}}/\cos\theta, \tag{12}\]  
where \(l\) is the length. By combining Equations (8)-(12), we can obtain the relationship between \(v_{p}\), \(u_{p}\), \(v_{p}\)\({}^{\prime}\), and \(u_{p}\)\({}^{\prime}\):  
\[v_{p}=\left(v_{p}^{\prime}+\left(u_{0}-u_{p}^{\prime}+\left(v_{0}/\cos\theta -v_{0}\right)/\tan\theta\right)\times\tan\theta\right)\times\cos\theta, \tag{13}\]  
\[u_{p}=\left(u_{p}^{\prime}+\left(v_{p}^{\prime}-v_{0}+\left(u_{0}/\cos\theta -u_{0}\right)/\tan\theta\right)\times\tan\theta\right)\times\cos\theta. \tag{14}\]  
The situation that the camera produces a right deflection angle \(\theta\) that the camera rotates \(\theta\) clockwise around the optical axis is similar to the above situation, as shown in Figure 6b here:  
\[l_{JN}=l_{o_{0}^{\prime}I}-l_{o_{0}^{\prime}N}, \tag{15}\]  
Figure 5:0 Schematic diagram of the image plane of the camera rotating around the optical axis. (**a**) Rotate counterclockwise; (**b**) Rotate clockwise.