# Steel Roll Eye Pose Detection Based on Binocular Vision and Mask R-CNN
## 4 Target Feature Extraction  
The pixel \(f\) (\(x\), \(y\)) value corresponds to the specific pixel point within the image. Upon undergoing the aforementioned image segmentation process, the image is transformed into an ellipsoidal binary image representing the installation area. \[F(x,y)=\left\{ \begin{array}{l}0,(x,y)\;Falling\;in\;the\;background\;area\\ 1,(x,y)\;Falling\;in\;the\;area\;of\;interest\\ \end{array} \right. \tag{12}\]  
Figure 14: Schematic diagram of eye roll segmentation. Figure 13: Color space segmentation. To determine the positional state of the mounting end face, edge detection of the mounting holes is essential for extracting the ellipse parameters during horizontal, vertical deviation, yaw angle, and pitch angle positional identification. The results of the edge detection for the mounting holes are illustrated in Figure 15.  
When the mounting end face of the steel coil is not parallel to the mounting end face of the inner corner detector, the image of the mounting hole edge captured by the binocular camera will appear as an ellipse due to angular projection. Building on the image segmented using the Mask R-CNN architecture and the image processed via the RGB vector space method, the Sobel edge extraction algorithm is then applied to obtain a series of pixel points along the ellipse. Finally, ellipse parameter fitting is performed to derive the ellipse parameters. The schematic diagram of the ellipse's right-angled coordinates is presented in Figure 16.  
The figure (\(x_{0}\), \(y_{0}\)) illustrates the coordinates of the ellipse's center. Here, (\(a\)) denotes the semi-major axis (half-length axis) of the ellipse, (\(b\)) signifies the semi-minor axis (half-short axis), and (\(\beta\)) represents the angle between the major axis of the ellipse and the horizontal axis, with counterclockwise direction considered positive. The parametric equation of the ellipse can be expressed as:  
\[\frac{\left[(x-x_{0})\cos\beta+(y-y_{0})\sin\beta\right]^{2}}{a^{2}}+\frac{ \left[-(x-x_{0})\sin\beta+(y-y_{0})\cos\beta\right]^{2}}{b^{2}}=1 \tag{13}\]  
The general form of the equation representing the curve of an ellipse is expressed as follows:  
\[Ax^{2}+Bxy+Cy^{2}+Dx+Ey+F=0 \tag{14}\]  
When the six parameters \(A\), \(B\), \(C\), \(D\), \(E\), and F are scaled uniformly, the represented ellipse remains unchanged. To prevent overlapping and zero solutions, the constraint  
Figure 16: Schematic diagram of elliptic rectangular coordinates. Figure 15: Mounting hole edge detection diagram. \(A+C=1\) is imposed. Additionally, it is essential to ensure the discriminant condition: \(\Delta=B^{2}-4 AC<0\). Consequently, the corresponding parameters of the ellipse are determined. \[\left\{ \begin{array}{l}x_{0}=\frac{\mathrm{BF}-2\mathrm{C}D}{4 AC-B^{2}}\\ y_{0}=\frac{\mathrm{B}D-2\mathrm{A}E}{4 AC-B^{2}}\\ \beta=\frac{1}{2}\mathrm{arctan}\Big{(}\frac{B}{A-C}\Big{)}\\ a=\sqrt{\frac{2\left(Ax_{i}^{2}+Bx_{i}y_{i}+Cy_{i}^{2}-F\right)}{A+C-\sqrt{B^{2 }+\left(A-C\right)^{2}}}}\\ b=\sqrt{\frac{2\left(Ax_{i}^{2}+Bx_{i}y_{i}+Cy_{i}^{2}-F\right)}{A+C+\sqrt{B^{2 }+\left(A-C\right)^{2}}}}\end{array} \right. \tag{15}\]  
According to the principle of least squares, the pixel points are substituted into the normalized sum of the general formula, which serves as the objective function for ellipse fitting:  
\[f(A,B,C,D,E,F)=\sum_{i=1}^{n}\Big{[}x_{i}^{2}+Bx_{i}y_{i}+C\Big{(}y_{i}^{2}-x_ {i}^{2}\Big{)}+Dx_{i}+Ey_{i}+F\Big{]}^{2} \tag{16}\]  
where \((x_{i},y_{i})\) represent the coordinates of the extracted edge pixel points. According to the Extreme Value Theorem, there exists a point at which the objective function attains its minimum value:  
\[\frac{\partial f}{\partial B}=\frac{\partial f}{\partial C}=\frac{\partial f }{\partial D}=\frac{\partial f}{\partial E}=\frac{\partial f}{\partial F}=0 \tag{17}\]  
Substituting \(A+C\) into Equation (16) for partial derivatives gives the parameters \(B\), \(C,D,E,F\). Then, using the constraint \(A+C=1\), determine \(A\).