# Steel Roll Eye Pose Detection Based on Binocular Vision and Mask R-CNN
## 5 Positional Deviation Solving
To obtain the three-dimensional coordinates of \(Q\) of the end face of the steel coil in the world coordinate system, a world coordinate system \(O_{w}-X_{w}Y_{w}Z_{w}\) with the same orientation as depicted in Section 2 is established, with left camera coordinate system \(O_{L}-X_{L}Y_{L}Z_{L}\) and right camera coordinate system \(O_{R}-X_{R}Y_{R}Z_{R}\), as shown in Figure 19.  
The attitude angle of the left camera relative to the world coordinate system is defined as (60\({}^{\circ}\), 30\({}^{\circ}\), 30\({}^{\circ}\)). Based on the principle of coordinate system translation, the linear imaging models of the left and right cameras can be interconnected to derive the translation matrix \(\mathbf{T}_{L}\), rotation matrix (\(\mathbf{M}_{L}\)), and external reference matrix (\(\mathbf{M}_{Lw}\)) from the left camera coordinate system \(O_{L}-X_{L}Y_{L}Z_{L}\) to the world coordinate system \(O_{w}-X_{w}Y_{w}Z_{w}\). \[T_{L}=[x_{L},y_{L},z_{L}]^{T} \tag{28}\]  
\[M_{L}= \begin{bmatrix}0.750&0.058&0.650\\ 0.500&0.433&-0.433\\ -0.750&1.125&0.217\end{bmatrix}  \tag{29}\]  
\[M_{Lw}= \begin{bmatrix}x_{L}&0.750&0.058&0.650\\ y_{L}&0.500&0.433&-0.433\\ z_{L}&-0.750&1.125&0.217\end{bmatrix}  \tag{30}\]  
The external reference matrix from the right camera coordinate system \(O_{R}-X_{R}Y_{R}Z_{R}\) to the world coordinate system \(O_{w}-X_{w}Y_{w}Z_{w}\) is (\(\mathbf{M}_{Rw}\)), which can be obtained from the external reference matrix of the left camera (\(\mathbf{M}_{Lw}\)) and the translation matrices (\(\mathbf{T}\)) and  
Figure 19: Schematic diagram of the coordinate system. rotation matrices (**R**) between the two cameras, and the translation and rotation matrices between the two cameras are obtained from the camera parameter calibration:  
\[M_{Rw}=\left[T-T_{L}\quad R\times M_{Lw}\right]= \begin{bmatrix}-65.495-x_{L}&0.739&0.072&0.653\\ -0.018-y_{L}&0.503&0.427&-0.444\\ 1.568-z_{L}&-0.749&1.117&0.233\end{bmatrix}  \tag{31}\]  
The coordinates of the center of the curling eye within the image coordinate systems of the left and right cameras, following target feature extraction, are as follows (\(u_{L}\), \(v_{L}\)), (\(u_{R}\), \(v_{R}\)). The coordinates of the center of the eye roll within the world coordinate system are as follows: (\(X_{w}\), \(Y_{w}\), \(Z_{w}\)). \[z_{1} \begin{bmatrix}u_{L}\\ v_{L}\\ 1\end{bmatrix} =M_{l}M_{Lw} \begin{bmatrix}x_{w}\\ y_{w}\\ z_{w}\\ 1\end{bmatrix}  \tag{32}\]  
\[z_{1} \begin{bmatrix}u_{R}\\ v_{R}\\ 1\end{bmatrix} =M_{r}M_{Rw} \begin{bmatrix}x_{w}\\ y_{w}\\ z_{w}\\ 1\end{bmatrix}  \tag{33}\]  
where (\(M_{Lw}\)), (\(M_{Rw}\)) are the camera external reference matrices, and (\(M_{l}\)), (\(M_{r}\)) are derived from the camera calibration test described in Section 2. The mapping relationship between the pixel coordinate systems of the left and right cameras and the world coordinate system, as delineated in Equation (27), elucidates the correlation between the coordinates of the center of the rolled eye within the image coordinate systems of the left and right cameras and the coordinates of the world coordinate system. Based on the relative positions of the camera coordinate system and the world coordinate system, it is evident that the end face of the steel roll is inclined at an angle to the lens, resulting in the circular mounting hole being imaged as an ellipse within the camera's field of view. Based on the relative positions of the camera coordinate system and the world coordinate system, it is evident that the end face of the steel roll is inclined at an angle to the lens, resulting in the circular mounting hole being imaged as an ellipse within the camera's field of view. As illustrated in Figure 20a, when the end face of the steel coil and the end face of the corner guard are parallel, the angle between the long axis of the ellipse and the horizontal axis is denoted as (\(\theta_{z}\)), as derived from the camera's external reference matrix.