## 3 Research on Image Acquisition System of Lining Cracks
### The Method of Fast Acquisition Parameter Calculation
#### 3.2.3 Camera Attitude  
When the inspection vehicle detects in the tunnel, due to the large tunnel cross-section, multiple cameras are required to work simultaneously to complete the full coverage of the image across the tunnel [21]. Therefore, the camera attitude control system is required to calculate the rotation angle of each camera.  
\begin{table}
\begin{tabular}{c c c c c c c c} \hline \hline
**Object Distance/m** & **5** & **10** & **20** & **30** & **40** & **50** & **60** \\ \hline
2 & 50 & 51 & 53 & — & — & — & — \\
3 & 35 & 37 & 40 & — & — & — & — \\
4 & — & — & 30 & 36 & 40 & — & — \\
5 & — & — & — & 28 & 38 & 45 & — \\
6 & — & — & — & 28 & 31 & 35 & — \\
7 & — & — & — & — & 33 & 38 & 42 \\ \hline \hline \end{tabular}
\end{table}
Table 2: The best focus under each object distance and zoom.  
Figure 5: Bivariate fitting section plot: \(X\) is the object distance, \(Y\) is the value of zoom, and \(Z\) is the corresponding best focus.  
In order to establish a camera angle control model, the tunnel contour is divided into several arcs according to the radius. As shown in Figure 6, the radii are \(R_{1}\), \(R_{2}\), \(R_{3}\),..., \(R_{m}\), the corresponding center angles are \(\theta_{1}\), \(\theta_{2}\), \(\theta_{3}\),..., \(\theta_{m}\), and the coordinates of each center are \((O_{ix}\), \(O_{iy})\). The developed control model complies with the following regulations: The direction whereby the center of the circle points to the arc is the positive direction of the radius; the azimuth angle corresponding to the starting radius of each arc is \(\alpha_{i}\), the \(LL\) and \(LR\) are the distances from the left and right walls of the tunnel to the carriageway, the width of the lane is \(L\), and \(n\) is the number of lanes.  
The corresponding length of each arc of the tunnel contour is \(R_{i}\theta_{i}\), then the cumulative length \(S_{i}\) of the \(i\)th segment arc in front of the tunnel is  
\[S_{i}=\sum_{i=1}^{i}R_{i}\theta_{i} \tag{9}\]  
For the direct shot point \(A_{i}\), the accumulated arc length \(s_{i}\) of the tunnel profile on its left is  
\[s_{i}=69.5+130(i-1)+s\times(d-1) \tag{10}\]  
where \(d\) is the lane number of the detection system located.  
When \(S_{a-1}\leq s_{i}\leq S_{a}\), the direct point \(A_{i}\) is located in the \(a\)-th arc segment, and its horizontal and vertical coordinates can be calculated as  
\[A_{ix}=O_{ax}+R_{a}\times\cos(\alpha_{a}-\frac{s_{i}-s_{a-1}}{R_{a}}) \tag{11}\]  
\[A_{iy}=O_{ay}+R_{a}\times\sin(\alpha_{a}-\frac{s_{i}-s_{a-1}}{R_{a}}) \tag{12}\]  
Combined with the coordinates \((B_{ix},B_{iy})\) of the working camera corresponding to the direct shot point, the cosine of the camera position angle can be obtained as  
\[\cos\beta_{i}=\frac{A_{ix}-B_{ix}}{\sqrt{\left(A_{ix}-B_{ix}\right)^{2}+\left( A_{iy}-B_{iy}\right)^{2}}} \tag{13}\]  
Then, using the arcosine function, the shooting angle of each camera can be calculated. If \(A_{iy}-B_{iy}\geq 0\):  
\[\beta_{i}=\cos^{-1}(\cos\beta_{i}),\ \cos^{-1}(\cos\beta_{i})\in[0,\pi] \tag{14}\]  
Figure 6: Camera attitude control model coordinate system.  
If \(A_{iy}-B_{iy}<0\):  
\[\beta_{i} =2\pi-\cos^{-1}(\cos\beta_{i}),\ \cos^{-1}(\cos\beta_{i})\in[0,\pi] \tag{15}\]  
Through the Matlab program, the above calculation process has been realized in a programmed way to realize the establishment of the camera attitude control model.