1. Introduction
Computerized automation is a standard practice, replacing humans in processes that are repetitive and able to be represented in data. In industry applications such as manufacturing or material testing, dials are used to communicate values (pressure, heat, etc.) which then may be recorded and used for calibration and monitoring purposes. In specific cases, buildings, which account for nearly 30% of the world’s CO2 emission, could save up to 18% of their emissions with careful usage of energy conservation and data monitoring [1]. Normally, this task would be conducted by a human, which may be prone to error and is time-consuming. Digital dials, connected to a computer, have eased this problem, though many apparati still use analog dials which cannot be read automatically. The replacement of analog for digital may not be economically or physically viable; instead, a camera mounted to view and record a dial’s readings may be more practical.
This paper tests two methods of Hough transform and one lightweight line-rotation method (section 2) on a dataset of 46 raw images and variations, detailed in section 3. Then, results are analyzed, and conclusions are drawn and discussed in section 4.
2. Research on current solutions
2.1. Hough transform
Hough transform [2] is a common technique used in circle and line detection, and has been used to detect dial locations and pointer angles, where Hough circle transform is used to localize dials, and Hough line transform is used to detect the pointer and then calculate the angle respective to the detected dial. Hough Line transform calculates sums of pixel values at each point (x,y). Then, by placing all values into an accumulator matrix, the longest lines in the image may be taken from the highest values in the matrix. Defining it sinusoidally:
\( f(x,y)=p(θ)=xcos{θ}+ysin{θ} \) (1)
Hough Circle transform is achieved in a similar process, but with circle detection instead of line detection [3]. In this paper, Hough transform was implemented with the open source python library OpenCV [4] developed by Intel.
Current research has used Hough transform extensively - Pochieta and Żyłka devised a system where a Canny edge detection filter and hough line transform is applied to detect the needle position, which is then corrected for parallax via a mirror in the camera device. Results presented in the paper states that the implemented algorithm’s accuracy is an order of magnitude higher than that of a human reader. However, these methods require pre-processing or manual calibration by the user for accurate numbers; in the system referenced above, users have to input the gauge radius value. Additionally, the algorithm presented in Pochieta and Żyłka makes no mention of testing circular gauges, another widely-used format [5].
2.2. Machine learning
Alternatively, researchers have used machine learning techniques such as neural networks to read values or assist in the dial detection process, which are expected to be less user intensive and require fewer steps to arrive at a prediction. Shu et al. suggests an algorithm where meters are isolated via neural network (YOLO-v5), corrected for perspective with a STM (Spatial Transform Model), and read with a module containing pre-processing and Hough line detection. Results presented indicate that the algorithm was able to achieve approximately 1.7% relative error [6]. Nevertheless, these methods are reliant on large quantities of data, are computationally expensive for cheap hardware, and are dependent on quality and comprehensiveness of data to be robust.
2.3. Line rotation
This paper also tested a naive method of creating a pointer “line,” rotating the line around a grayscale image and recording its bitwise_and with it. The method then simply takes the angle with the maximum bitwise_and, and assumes that it was the pointer. This method is extremely lightweight compared to utilizing Hough transform or some machine learning techniques. All methods tested in this paper can be implemented in low end computing devices and require no specialized components to run.
3. Research methods – testing and validation
3.1. Dataset
For testing purposes, a dataset of 46 raw images of varying sizes was assembled from various sources: Google Images, test images from other projects found on public GitHub, and Howells et al.’s Real Gauges dataset [7]. All images were cropped so that the gauge face constitutes most of the image and were selected to be mostly facing the camera directly, to avoid parallax or perspective errors.
Where possible, the separate images are created using photoshop tools to remove distracting text, icons, screws, and heavy shadows. Pointers are also rotated around the center of the dial to simulate different reading values from the same meter.
Then, images are also binarized via Otsu’s thresholding [8]. This is done to clarify the image and increase the contrast of the pointer to the dial. Where needed, a static thresholding value is utilized in place of Otsu because of it failing to differentiate the pointer and the dial face. Images are also inverted so dial faces are light, and pointers are dark.
Figure 1. Raw image of a dial, cropped. | Figure 2. Processed image of the same dial, binarized with Otsu’s and hand-cleaned. |
3.2. Initial results
Initial testing showed that the aforementioned line rotation method outperformed both Hough Line implementations significantly. Due to the nature of the method used, there will always be a maximum for all 360 angle measures. In contrast, both Hough line implementations could not return any value when Hough Line transform failed to find a suitable line due to pointer shape, shadow, or other obstructions.
Error is calculated by dividing the difference between ground truth and predicted value by 360 degrees. All images that are unreadable are treated as an error of 100 percent. While Hough transform performs roughly as well as Line Rotation when it can detect the pointer (~0.65% error difference), it has four times the error of Line Rotation for all cases considered.
Figure 3. Average error on all readable images. |
Figure 4. Average error on all images. |
4. Discussion and conclusion
4.1. Results discussion
There were a few assumptions made during the testing process: dials would always be circular and directly facing the camera. This ensures that parallax would not greatly influence results, and that the dial center would remain the center of the image. This naive line rotation method would not function well without these provisions. A few factors may be responsible for the failure of Hough Transform to outperform Line Rotation, or even detect a pointer in the image: thick pointers, discolored or confusing dial faces, or ineffective parameters in the implementation, all of which were manipulated without much change in Hough Transform results.
Nevertheless, it is clear that line rotation exceeds both simple Hough Line implementations in accuracy and robustness for these cases - enough to substitute a human reader in all but the most precise scenarios, such as simple data monitoring.
4.2. Conclusion and future work
In this paper, two Hough Line implementations and Line Rotation methods were tested on a dataset of 46 raw images and their variations. All results point to Line Rotation as more robust, and with preprocessing and corrections the method can achieve down to 0.3% error while being extremely lightweight. This accuracy is high enough to be potentially utilized in industrial data monitoring purposes.
Future research will focus on improving robustness against pointer tail mistakes and testing with more varied meters.
References
[1]. Guerra-Cabrera A, Barbano G, Tardioli G, Mallya Udupi G (2020). Computer Vision-based Reader for analogue Energy/Water Meters in low-cost embedded System: a Case Study in an Office Building in Scotland. E3S Web of Conferences (Vol.172).
[2]. Hough, Paul (1962). Method and means for recognizing complex patterns. U. S. Patent 3,069,654, December 18, 1962.
[3]. Jarvinen, Niko (2022). Configurable Pointer Meter Reader based on Computer Vision. Tampere University.
[4]. Bradski, G. (2000). The OpenCV Library. Dr. Dobb’s Journal of Software Tools.
[5]. Pociecha, Dominik, Zylka, Pawel. (2015). The histogram-enhanced Hough transform applied to automated readout of analogue gauge meters using digital image processing. Measurement Automation Monitoring. 61. 507-511.
[6]. Shu, Yan, Liu, Shaohui, Xu, Honglei, Jiang, Feng. (2023). Read Pointer Meters in complex environments based on a Human-like Alignment and Recognition Algorithm. 10.48550/arXiv.2302.14323.
[7]. Howells, Ben, Charles, James, Cipolla, Roberto. (2021). Real-time analogue gauge transcription on mobile phone. 2369-2377. 10.1109/CVPRW53098.2021.00269.
[8]. Nobuyuki Otsu (1979). "A threshold selection method from gray-level histograms". IEEE Trans. Sys. Man. Cyber. 9 (1): 62–66. DOI:10.1109/TSMC.1979.4310076.
Cite this article
Peng,Z. (2023). Hough transform and line rotation on analog gauge reading: A case study. Applied and Computational Engineering,22,14-18.
Data availability
The datasets used and/or analyzed during the current study will be available from the authors upon reasonable request.
Disclaimer/Publisher's Note
The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of EWA Publishing and/or the editor(s). EWA Publishing and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
About volume
Volume title: Proceedings of the 5th International Conference on Computing and Data Science
© 2024 by the author(s). Licensee EWA Publishing, Oxford, UK. This article is an open access article distributed under the terms and
conditions of the Creative Commons Attribution (CC BY) license. Authors who
publish this series agree to the following terms:
1. Authors retain copyright and grant the series right of first publication with the work simultaneously licensed under a Creative Commons
Attribution License that allows others to share the work with an acknowledgment of the work's authorship and initial publication in this
series.
2. Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the series's published
version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgment of its initial
publication in this series.
3. Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and
during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See
Open access policy for details).
References
[1]. Guerra-Cabrera A, Barbano G, Tardioli G, Mallya Udupi G (2020). Computer Vision-based Reader for analogue Energy/Water Meters in low-cost embedded System: a Case Study in an Office Building in Scotland. E3S Web of Conferences (Vol.172).
[2]. Hough, Paul (1962). Method and means for recognizing complex patterns. U. S. Patent 3,069,654, December 18, 1962.
[3]. Jarvinen, Niko (2022). Configurable Pointer Meter Reader based on Computer Vision. Tampere University.
[4]. Bradski, G. (2000). The OpenCV Library. Dr. Dobb’s Journal of Software Tools.
[5]. Pociecha, Dominik, Zylka, Pawel. (2015). The histogram-enhanced Hough transform applied to automated readout of analogue gauge meters using digital image processing. Measurement Automation Monitoring. 61. 507-511.
[6]. Shu, Yan, Liu, Shaohui, Xu, Honglei, Jiang, Feng. (2023). Read Pointer Meters in complex environments based on a Human-like Alignment and Recognition Algorithm. 10.48550/arXiv.2302.14323.
[7]. Howells, Ben, Charles, James, Cipolla, Roberto. (2021). Real-time analogue gauge transcription on mobile phone. 2369-2377. 10.1109/CVPRW53098.2021.00269.
[8]. Nobuyuki Otsu (1979). "A threshold selection method from gray-level histograms". IEEE Trans. Sys. Man. Cyber. 9 (1): 62–66. DOI:10.1109/TSMC.1979.4310076.