# Vehicle Distance Measurement Method of Two-Way Two-Lane Roads Based on Monocular Vision
## 2 Methods
### Establishment of Vehicle Distance Measurement Model  
#### 2.2.1 Imaging Principle of Monocular Vision  
The imaging principle of the monocular vision system can be described by the pinhole imaging model. The imaging process is actually the process of mapping the three-dimensional space scene in reality to the two-dimensional space. Four coordinate systems can be used to express this mapping relationship. As shown in Figure 4, P is the three-dimensional coordinate point, and P' is the imaging position of Pon, the image plane of the camera.  
As shown in the above figure, \(\text{U}\text{O}_{0}\text{V}\) is the pixel coordinate system, which takes \(\text{O}_{0}\) of the CCD image plane as the coordinate origin. The U-axis and V-axis are respectively parallel to the two vertical edges of the CCD image plane, and the coordinates are represented by (\(u\), \(v\)). \(\text{X}\text{O}_{1}\text{Y}\) is the image coordinate system, which takes the center of the CCD image plane as the coordinate origin \(\text{O}_{1}\), the X-axis and Y-axis are the axes parallel to the U-axis and V-axis of the pixel coordinate system, respectively, and (\(u_{0}\), \(v_{0}\)) is the position of \(\text{O}_{1}\) in the pixel coordinate.  
\(\mathrm{O}_{w}X_{w}Y_{w}Z_{w}\) is the world coordinate system, which is the absolute coordinate system of the objective world, and the coordinates are represented by (\(X_{w}\), \(Y_{w}\), \(Z_{w}\)). \(\mathrm{O}_{c}X_{c}Y_{c}Z_{c}\) is the camera coordinate system, which takes the optical center of the camera as the coordinate origin \(\mathrm{O}_{c}\); the \(\mathrm{X}_{c}\)-axis and the \(\mathrm{Y}_{c}\)-axis are the axes parallel to the X-axis and Y-axis of the image coordinate system, respectively, and \(\mathrm{Z}_{c}\) is the optical axis of the camera. The world coordinate system can be converted into the camera coordinate system through the rotation matrix R and translation matrix T.  
Setting \(dx\) and \(dy\) as the physical conversion scale of the unit pixel in the X and Y directions in the image coordinate system, respectively, and \(f\) as the distance between the origin of the image coordinate system and the origin of the camera coordinate system, that is, the focal length. The conversion formula between the coordinates of the three-dimensional world coordinate system and the coordinates of the two-dimensional pixel coordinate system is as follows [30]:  
\[\begin{split} Z_{c}\left[\begin{array}{c}u\\ v\\ 1\end{array}\right]=\left[\begin{array}{ccc}1/dy&0&u_{0}\\ 0&1/dy&v_{0}\\ 0&0&1\end{array}\right]\left[\begin{array}{ccc}f&0&0&0\\ 0&f&0&0\\ 0&0&1&0\end{array}\right]\left[\begin{array}{c}R&T\\ \overset{\rightarrow}{\underset{\eta}{\underset{1}{\rightarrow}}}&1\end{array} \right]\left[\begin{array}{c}X_{w}\\ Y_{w}\\ Z_{w}\\ 1\end{array}\right],\\ \\ =\left[\begin{array}{ccc}a_{x}&0&u_{0}&0\\ 0&a_{y}&v_{0}&0\\ 0&0&1&0\end{array}\right]\left[\begin{array}{c}R&T\\ \overset{\rightarrow}{\underset{\eta}{\underset{1}{\rightarrow}}}&1\end{array} \right]\left[\begin{array}{c}X_{w}\\ Y_{w}\\ Z_{w}\\ 1\end{array}\right]\end{split} \tag{5}\]  
where \(a_{x}=f/dx\), \(a_{y}=f/dy\).