# Computer Vision-Based Approach for Reading Analog Multimeter
## 3 Angle Detection of Pointer  
### Spin Center Calculation of Pointer  
Based on the located \(\mathbf{R}_{\textit{right-end}}\) and \(\mathbf{R}_{\textit{left-end}}\) in \(\mathbf{R}_{\textit{IM}}\) presented in Section 2.5, the relationship between the pointer indicated by \(\theta_{p}\) and the scale in \(\mathbf{R}_{\textit{IM}}\) (refer to Figure 5) were replotted by adding the coordinates \(\{(x_{r1},y_{r1})\), \((x_{r2},y_{r2})\), \((x_{r3},y_{r3})\), \((x_{r4},y_{r4})\}\) of \(\mathbf{R}_{\textit{right-end}}\) and \(\{(x_{l1},y_{l1})\), \((x_{l2},y_{l2})\), \((x_{l3},y_{l3})\), \((x_{l4},y_{l4})\}\) of \(\mathbf{R}_{\textit{left-end}}\), as depicted in Figure 9. In this study, the templates for the right-end scale, i.e., \(\mathbf{T}_{\textit{right-end}}^{\textit{EGM}}\), \(\mathbf{T}_{\textit{bright-right-end}}^{\textit{PGM}}\) and \(\mathbf{T}_{\textit{dark-right-end}}^{\textit{PGM}}\) given respectively in Figure 7d-f, were selected with a \(W_{r}\times H_{r}\) rectangular ROI so that one pair of diagonal corner points were just passed over by a dummy straight line of the right-end scale (from the spin center of pointer) as redrawn in Figure 10a-c. Therefore, the angle of the right-end of the scale (\(\theta_{r}\) in degrees) was expressed by  
\[\theta_{r}=\tan^{-1}\left(\frac{H_{r}}{W_{r}}\right)\times\frac{180^{\circ}}{ \pi}. \tag{14}\]  
Similarly, the templates for the left-end scale, i.e., \(\mathbf{T}_{\textit{left-end}}^{\textit{EGM}}\), \(\mathbf{T}_{\textit{bright-left-end}}^{\textit{PGM}}\) and \(\mathbf{T}_{\textit{dark-left-end}}^{\textit{PGM}}\) given respectively in Figure 7g-i, were selected with a \(W_{l}\times H_{l}\) rectangular ROI so that one pair of diagonal corner points were just passed over by a dummy straight line of the left-end scale (comes from the spin center of pointer), as redrawn in Figure 10d-f. Therefore, the angle of the left-end of the scale (\(\theta_{l}\) in degrees) was expressed by  
\[\theta_{l}=\tan^{-1}\left(\frac{W_{l}}{H_{l}}\right)\times\frac{180^{\circ}} {\pi}+90^{\circ}. \tag{15}\]  
In the current study on the YF-370A A-meter, because of \(W_{r}\simeq H_{r}\) and \(W_{l}\simeq H_{l}\), we thus had \(\theta_{r}\simeq 45^{\circ}\) and \(\theta_{l}\simeq 135^{\circ}\). These matched with the ground-truth angles, i.e., \(\theta_{\text{gt}}(0)|_{R(0)=0}=45^{\circ}\) and \(\theta_{\text{gt}}(57)|_{R(57)=\infty}=135^{\circ}\), as listed in Table 2, which were obtained by means of a protractor. Figure 8: A template \(\mathbf{T}_{\textit{s}\textit{d}\textit{c}\textit  
By reconsidering the illustration given in Figure 9, once the \(\mathbf{R}_{\textit{right-end}}\) and \(\mathbf{R}_{\textit{left-end}}\) were located, the Equations (14) and (15) could be rewritten as  
\[\theta_{r}=\tan^{-1}\left(\frac{|y_{r2}-y_{r3}|}{|x_{r2}-x_{r3}|}\right)\times \frac{180^{\circ}}{\pi}, \tag{16}\]  
and  
\[\theta_{l}=\tan^{-1}\left(\frac{|x_{l1}-x_{l4}|}{|y_{l1}-y_{l4}|}\right)\times \frac{180^{\circ}}{\pi}+90^{\circ}. \tag{17}\]  
In addition, by observing the Figure 9, the straight line of right end of scale was shown to pass approximately over \((x_{r2},y_{r2})\) and \((x_{r3},y_{r3})\in\mathbf{R}_{\textit{right-end}}\) and the left-end of the scale passed approximately over \((x_{l1},y_{l1})\) and \((x_{l4},y_{l4})\in\mathbf{R}_{\textit{left-end}}\). By solving the two line equations joining one point, the spin center of pointer \((x_{c},y_{c})\) was thus obtained by the following expressions  
\[ \begin{array}{l}x_{c}=\left(y_{r3}-y_{l4}+\frac{(y_{l4}-y_{l1})x_{l4}}{x_{ l4}-x_{l1}}+\frac{(y_{r3}-y_{r2})x_{r3}}{x_{r2}-x_{r3}}\right)/\left(\frac{y_{l4} -y_{l1}}{x_{l4}-x_{l1}}+\frac{y_{r3}-y_{r2}}{x_{r2}-x_{r3}}\right),\\ y_{c}=y_{r3}+\frac{y_{r3}-y_{r2}}{x_{r2}-x_{r3}}(x_{r3}-x_{c}).\end{array}