# Computer Vision Measurement of Pointer Meter Readings Based on Inverse Perspective Mapping
## 2 Measurement Principle  
### Reverse Projection of the Meter Image  
The present method for measuring readings of the pointer meter is shown in Figure 2. The camera intrinsic parameters A are calibrated by the Zhang [19] in the Appendix A for the detail. For obtaining the extrinsic parameters, \(X_{w}\)=\(Y_{w}\) coordinate plane of a World Coordinate System (WCS) is established on the meter surface, direction of the \(X_{w}\)-axis is parallel to connection line from center of the pointer rotation to the starting scale, the \(Z_{w}\) axis perpendicular to the meter surface, and origin of the World Coordinate System is at center of the pointer rotation. Radii of circular arc of the scale distribution and center angles corresponding to the distribution can be determined by manually measuring the dimension distribution of the meter scales. So, world coordinates of midpoint on every short scale can be calculated by the radius \(r_{s}\) and angles as:  
\[\begin{array}{l}X_{Wi}=r_{5}\times\cos(\gamma\times i)\\ Y_{Wi}=r_{5}\times\sin(\gamma\times i)\\ Z_{Wi}=0\end{array} \tag{1}\]  
Here \(\gamma\) is center angle between neighbors two scales, \(i\) is the scale.  
Then, the sub-pixel coordinates \((u,v)^{T}\) of midpoint of each short scale on the meter image can be detected by sub-pixel detection algorithm [20]. The camera extrinsic parameters \([R,T]\) are determined by the world and pixel coordinates of the midpoints. And the world coordinates of midpoints on the short scales are transformed into the camera coordinates \((X_{Ci},Y_{Ci},Z_{Ci})^{T}\) by the extrinsic parameters.  
Figure 2: The different steps of measurement the readings of the pointer meter.  
For transforming the meter image parallel to the meter surface by the inverse perspective mapping, normal vector \(\overrightarrow{k}=[k_{x},k_{y},k_{z}]\) of the meter surface is calculated by the camera coordinates of three midpoints to obtain angle \(\theta\) between \(\overrightarrow{k}\) and normal vector of the meter's theoretical image plane. So, the inverse perspective mapping is finished by rotating the meter's theoretical image plane to the angle \(\theta\) relative to \(\overrightarrow{k}\). From the Rodrigues formula, the rotation transformation matrix \(M\) for the image plane is obtained by \(\overrightarrow{k}\):  
\[M=\left[\begin{array}{ccc}k_{x}^{2}&k_{y}k_{x}&k_{z}k_{x}\\ k_{x}k_{y}&k_{y}^{2}&k_{z}k_{y}\\ k_{x}k_{z}&k_{y}k_{z}&k_{z}^{2}\end{array}\right] \tag{2}\]  
The meter image is rotated by the matrix \(M\) to make the meter image parallel to the surface of the meter. The coordinate of the point \(\left(X_{i},Y_{i},Z_{i}\right)^{T}\) in the meter image is transformed by M to the coordinates of the points \(\left(x_{i},y_{i},z_{i}\right)^{T}\) in the transformed meter image, as shown in Equation (3).  
\[\left[\begin{array}{c}x_{i}\\ y_{i}\\ z_{i}\end{array}\right]=M\left[\begin{array}{c}X_{i}\\ Y_{i}\\ Z_{i}\end{array}\right] \tag{3}\]  
Here, the \(z_{i}\) of all the points in the transformed image are the same. Therefore, the coordinates of the critical point (including the rotation center and the endpoint of the pointer) in the transformed meter image can be corrected in this way, identifying the reading of the pointer meter.