## 3 The key Technology of the Multi-DOF Automatic Image Acquisition System
### The Calculation of Camera Position
#### 3.1.1 Camera Position Calculating Method by Mathematical Modeling  
In the process of object movement, it is necessary to ensure that the image is in the camera field of view, that is, the camera needs to be aligned with the object through the rotating axis. In order to meet this constraint, we established a mathematical model to study the multi-axis geometric relationship as shown in Figure 5. The coordinate system was established with the center of the initial moment of the object being photographed as the coordinate origin, the coordinates of the object to be photographed were \(O\) (0, 0, 0) at this time. At the initial moment, the camera direction was vertically downward. The camera installation was set as \(h_{0}\), and the camera coordinates were \(C\) (0, 0, \(h_{0}\)) as shown in Figure 5a. Suppose that the camera is in focus by moving up \(z_{0}\), and the camera coordinates are \(C^{\prime}\) (0, 0, \(h_{0}+z_{0}\)  
Figure 4: Image acquisition flow diagram. as shown in Figure 5b. Control the \(x\)- and \(y\)-axes to move \(\Delta x\) and \(\Delta y\), respectively. At the same time, for keeping the distance between the camera and the object unchanged, it is necessary to control the \(z\)-axis motion \(\Delta z\) to ensure that the distance between the camera and the object is \(h_{0}+z_{0}\). At this time, the center coordinates and camera coordinates of the photographed object become \(O^{\prime}\) (\(\Delta x\), \(\Delta y\), 0) and \(C^{\prime}\) (0, 0, \(h_{0}+z_{0}-\Delta z\)), as shown in Figure 5c. To guarantee that the camera can shoot the object, rotation axis A and B are controlled to rotate the corresponding angle to ensure that the camera optical axis points to the object to be photographed, as shown in Figure 5d. The specific process, firstly, is the \(a\)-axis controls the camera rotation \(\alpha\), and then the \(b\)-axis controls the camera rotation \(\beta\), given that,  
\[ \begin{split}\tan(\alpha)&=\frac{\Delta x}{h_{0}+z _{0}-\Delta z}\\ \tan(\beta)&=\frac{\Delta y}{\sqrt{\Delta x^{2}+ \left(h_{0}+z_{0}-\Delta z\right)^{2}}}\\ \Delta z&=h_{0}+z_{0}-\sqrt{\left(h_{0}+z_{0} \right)^{2}-\Delta x^{2}-\Delta y^{2}}\end{split}  \tag{1}\]  
Based on Equation (1), the rotation angle of the rotating shaft can be calculated. There are inevitably installation errors that must be considered in the process of building the system. Hence, the camera may have a certain offset relative to the object in the x, y, and z directions at the initial moment. Specifically, in the actual case, the initial coordinates of the camera are \(C\) (\(x_{0}\), \(y_{0}\), \(h_{0}\)), and \(x_{0}\), \(y_{0}\), and \(h_{0}\) are unknown. In this case, the coordinate motion relationship among the axes can be modified as follows:  
\[ \begin{split}\tan(\alpha)&=\frac{\Delta x-x_{0}}{h_{ 0}+z_{0}-\Delta z}\\ \tan(\beta)&=\frac{\Delta y-y_{0}}{\sqrt{\left( \Delta x-x_{0}\right)^{2}+\left(h_{0}+z_{0}-\Delta z\right)^{2}}}\\ \Delta z&=h_{0}+z_{0}-\sqrt{\left(h_{0}+z_{0} \right)^{2}-\left(\Delta x-x_{0}\right)^{2}-\left(\Delta y-y_{0}\right)^{2}} \end{split}  \tag{2}\]  
To realize the calculation of \(x_{0}\), \(y_{0}\), and \(h_{0}\), we manually adjust the camera and the object to calibrate the parameters \(x_{0}\), \(y_{0}\), and \(h_{0}\). Specifically, the \(x\)-, \(y\)-, \(z\)-axes move randomly in multiple positions, then the rotation axis is adjusted artificially to ensure that the object is in the center of the camera field of view.