# Computer Vision-Based Approach for Reading Analog Multimeter
## 3 Angle Detection of Pointer
### Scanning Approach to Detect the Pointer  
The traditional projection scheme was borrowed here to detect the pointer. Our approach was to scan the image (\(\mathbf{R}_{IM}\)) with a _scanline_ (which has a length, \(L\)) about the spin center \((x_{c},y_{c})\) from \(\theta_{r}\) to \(\theta_{l}\), as illustrated in Figure 11 so that all pixels within the sector region were visited once at least by the scan. Thus, the scan step (\(\Delta\theta\)) was selected carefully and is presented later in this section. Here, \(L\) can be determined by the distance between \((x_{c},y_{c})\) and \((x_{\tau 2},y_{\tau 2})\) (or \((x_{l1},y_{l1})\)), i.e., \(L=\sqrt{(x_{c}-x_{\tau 2})^{2}+(y_{c}-y_{\tau 2})^{2}}+\delta\), as illustrated in Figure 9. In this study, the extent (\(\delta\)) was set heuristically to 15 for our experiments. The method was as follows: Let \(S(i)\) be the set of all pixels belonging to the \(i\)-th scanline, and \(\theta(i)\) represent the corresponding \(\theta\)-value of the \(i\)-th scanline. In addition, let \(g(p)\) be the image intensity (or grayscale value) of the pixel (\(p\)). Therefore, the accumulation of all pixels' intensities within the \(i\)-th scanline, \(A(i)\), otherwise known as the \(A\)-quantity, was expressed as  
\[A(i)=\sum_{p\in S(i)}g(p). \tag{19}\]  
Ideally, since the appearance of the pointer tends to be a dark color, the pointer indicated by the \(k\)-th scanline should possess the lowest accumulation value, \(A(k)=\min_{\forall i}A(i)\), and the pointer's angle (\(\theta_{p}\)) is intuitively the corresponding \(\theta(k)\). However, this detection rule can fail due to the very thin pointer as well as the interferences of characters and the pointer's shadow on the meter surface. In order to enhance the detection correctness, the gradient of \(A(i),\forall i\) was further derived as \(GA(i),\forall i\) or called the profile of \(GA\). Since along the scanning direction, the \(A\)-quantity of the thin pointer and its one neighbor may be changed from a large amount to a small amount or from a small amount to a large amount, the pointer's position indicated by the \(k\)-th scanline should possess  
Figure 10: (**a–c**) illustrate that the templates, \(\mathbf{T}_{right-end}^{EGM}\), \(\mathbf{T}_{bright-right-end}^{PGM}\) and \(\mathbf{T}_{dark-right-end}^{PCM}\), given respectively in Figure 7-d,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; (**d–f**) illustrate that the templates, \(\mathbf{T}_{left-end}^{EGM}\), \(\mathbf{T}_{bright-left-end}^{PGM}\) and \(\mathbf{T}_{dark-left-end}^{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. the largest change with zero-crossing property, where the sign of \(GA(k)\) and that of \(GA(k+1)\) are mutually opposite. The pointer's angle \(\theta_{p}\) was thus detected and expressed by  
\[\theta_{p}=\{\theta(k)|d(k)=\max_{\forall i,sgn(GA(i))\
eq sgn(GA(i+1))}d(i), \texttt{ where }d(i)=|GA(i)|+|GA(i+1)|\}. \tag{20}\]  
Referring to Figure 11 in order to perform effectively the scanning process, the incremental amount of scanning degree \(\Delta\theta\) for each step needed to be determined so that the total number of scanning steps with \(\Delta\theta\) in the image domain was satisfied but not redundant. The following method was used: Let the changing amount in the horizontal and vertical directionswith the scanning range (\(\theta_{R}\)) be a full range of \(FR_{x}\) and \(FR_{y}\), respectively. Theoretically, the larger one between \(FR_{x}\) and \(FR_{y}\) will dominate the \(\Delta\theta\) so that there are more scanlines to cover all the pixels within the sector region with the \(\theta_{R}\) during the scanning process.