*3.2. Test Results for Optimization of Mounting Positions*

During testing, dual cameras were mounted on the vehicle, and objects were installed at distances ranging between 1 m–5 m at intervals of 0.5 m on an actual road. Then, the differences between the X-coordinates captured by the left and right cameras were computed and substituted into Equation (2) to verify the precision. The calculated results are presented in Figures 9–11.

**Figure 9.** Test results with respect to varying baselines and angles at a height of 30 cm: (**a**) error rates corresponding to various angles and a baseline of 10 cm, (**b**) error rates corresponding to various angles and a baseline of 20 cm, (**c**) error rates corresponding to various angles at a baseline of 30 cm.

**Figure 10.** Test results with respect to varying baselines and angles at a height of 40 cm: (**a**) error rates corresponding to various angles and a baseline of 10 cm, (**b**) error rates corresponding to various angles and a baseline of 20 cm, (**c**) error rates corresponding to various angles and a baseline of 30 cm.

Figure 10 depicts the test results corresponding to a height of 40 cm. Figure 10a–c illustrates the variation in the degree of precision with respect to varying angles, corresponding to baselines of 10 cm, 20 cm, and 30 cm, respectively.

Figure 11 depicts the test results corresponding to a height of 50 cm. Figure 11a–c illustrates the variation in the degree of precision with respect to varying angles, corresponding to baselines of 10 cm, 20 cm, and 30 cm, respectively.

**Figure 11.** Test results with respect to various baselines and angles at a height of 50 cm: (**a**) error rates corresponding to various angles and a baseline of 10 cm, (**b**) error rates corresponding to various angles and a baseline of 20 cm, (**c**) error rates corresponding to various angles and a baseline of 30 cm.

Table 1 summarizes the result of Figures 9–11. It is evident from Figures 9–11 that the error rate exhibited a decreasing tendency as the angle was increased. Meanwhile, it tended to decrease as the baseline was increased. Finally, the error rate decreased when the height was increased from 30 cm to 40 cm, and it increased when the height was increased to 50 cm.


**Table 1.** Test results for optimization of mounting positions.

Based on the aforementioned data, the best result was obtained corresponding to a height of 40 cm, a baseline of 30 cm, and an angle of inclination of 12◦. In the next section, these values are used to validate the theoretical equation of distance measurement.

### **4. Proposed Theoretical Equation for Forward Distance Measurement**

*4.1. Measurement of the Distance to an Object in Front of the Vehicle on a Straight Road*

The Z-coordinate of an object in front of the vehicle was obtained by using the coefficient α in Equation (2) (as evaluated via focal length correction) as the focal length and substituting it into Equation (1). However, during testing, the cameras were installed at an angle of inclination *θ*, to capture the close-range ground. That is, the optical axes of the cameras and the ground were not parallel during testing.

The Z-coordinate of the object relative to the position of the camera can be calculated considering the angle *θ* in Equation (3):

$$
\begin{bmatrix} X\_{\mathcal{S}} \\ Y\_{\mathcal{S}} \\ Z\_{\mathcal{S}} \end{bmatrix} = \begin{bmatrix} 1 & 0 & 0 \\ 0 & -\cos\theta & -\sin\theta \\ 0 & -\sin\theta & \cos\theta \end{bmatrix} \begin{bmatrix} X \\ Y \\ Z \end{bmatrix} + h \begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix} \tag{3}
$$

where:

*XgYgZg*—the coordinates of the object considering the angle of inclination of mounted cameras; the local coordinate system with their origins at the center of dual cameras. *θ*—the angle of inclination of the mounted cameras.

*h*—mounting heights of the cameras.

On a straight road similar to that depicted in Figure 12, the calculation of the distance between the cameras and the object in front of the vehicle requires only an estimation of the longitudinal vertical distance. Therefore, *Zg* can be considered to be the distance between the cameras and the object in front of the vehicle.

**Figure 12.** Distance to the object in front of the vehicle on a straight road.

#### *4.2. Measurement of the Distance to an Object in Front of the Vehicle on a Curved Road*

On a curved road similar to that depicted in Figure 13, the radius of curvature of the road should be incorporated into the measurement of the distance to the object in front of the vehicle. Therefore, after calculating the vertical distance using the object's *X*- and *Z*-coordinates, the distance to the object in front of the vehicle was calculated by considering the radius of curvature:

$$chord = \sqrt{X\_{\mathcal{S}}^2 + Z\_{\mathcal{S}}^2} \tag{4}$$

where:

*chord*—the vertical distance between the vehicle and object.

An angle ϕ is subtended at the center of the curvature and the vertical distance from the camera position to the object in front of the vehicle. An angle ϕ can be calculated as follows:

$$\varphi = \cos^{-1}(\frac{\sqrt{R^2 - \left(\frac{\text{chord}}{2}\right)^2}}{R}) \tag{5}$$

where:

ϕ—the angle subtended by the vehicle and the object at the center of curvature of the road *R*—the radius of curvature of the road.

The length of the arc of the circle corresponding to the aforementioned *chord* was calculated using ϕ and *R*, by applying Equation (6):

$$\text{arc} = 2\pi R \cdot \frac{\text{op}}{360} \tag{6}$$

where:

arc—the distance between the vehicle and the object along the curved road.

**Figure 13.** Distance to the object in front of the vehicle on a curved road.
