Automated Reading of High Volume Water Meters
Total Page:16
File Type:pdf, Size:1020Kb
Automated Reading of High Volume Water Meters by Jessica Ulyate Thesis presented in partial fulfilment of the requirements for the degree of Master of Science in Engineering at Stellenbosch University Supervisor: Dr. R. Wolhuter Department of Electrical and Electronic Engineering March 2011 Declaration By submitting this thesis electronically, I declare that the entirety of the work contained therein is my own original work, that I am the sole author thereof (save to the extent explicitly otherwise stated), that reproduction and publication thereof by Stellenbosch University will not infringe any third party rights and that I have not previously in its entirety or in part submitted it for obtaining any qualification. March 2011 Copyright © 2011 Stellenbosch University All rights reserved. i Abstract Accurate water usage information is very important for municipalities in order to provide accurate billing information for high volume water users. Meter reading are currently obtained by sending a person out to every meter to obtain a manual reading. This is very costly with regards to time and money, and it is also very error prone. In order to improve on this system, an image based telemetry system was developed that can be retrofitted on currently installed bulk water meters. Images of the meter dials are captured and transmitted to a central server where they are further processed and enhanced. Character recognition is performed on the enhanced images in order to extract meter readings. Through tests it was found that characters can be recognised to 100% accuracy for cases which the character recognition software has been trained, and 70% accuracy for cases which is was not trained. Thus, an overall recognition accuracy of 85% was achieved. These results can be improved upon in future work by statistically analysing results and utilizing the inherent heuristic information from the meter dials. Overall the feasibility of the approach was demonstrated and a way forward was indi- cated. ii Samevatting Dit is belangrik vir munisipaliteite om akkurate water verbruikingssyfers te hê sodat hulle akkurate rekeninge aan hoë volume water gebruikers kan stuur. Tans besoek ’n persoon fisies elke meter om meterlesings te verkry. Dit is egter baie oneffektief ten opsigte van tyd en geld. Die metode is ook baie geneig tot foute. Ten einde te verbeter op hierdie stelsel was ’n beeld gebaseerde telemetrie stelsel ontwerp wat geïnstalleer word op huidig geïnstalleerde hoë volume water meters. Beelde van die meters word na ’n sentrale bediener gestuur waar dit verwerk word en die beeld kwaliteit verbeter word. Karakter herkenning sagteware word gebruik om die meter lesings te verkry vanuit die verbeterde beelde. Deur middel van toetse is gevind dat karakters herken kan word tot op 100% graad van akkuraatheid in gevalle waar die karakter herkenning sagteware opgelei is, en 70% akkuraatheid vir gevalle waarvoor dit nie opgelei was nie. Dus was ’n algehele herkennings akkuraatheid van 85% behaal. Hierdie resultate kan verbeter word in die toekoms deur die resultate statisties te analiseer en die inherente heuristieke inligting van die meter syfers te benutting. Ten slotte, in die tesis was die haalbaarheid van die benadering gedemonstreer en ’n weg vorentoe vir toekomstige werk aangedui. iii Acknowledgements I would like to express my sincere gratitude towards the following people: • My promoter, Dr. R. Wolhuter for his guidance and insight as well as the many hours spent reviewing my work. • Prof J. du Preez for his insights and invaluable suggestions. • My friends and family for all their encouragement throughout this project. iv Contents Declaration i Contents v List of Figures viii List of Tables x List of Appreviations xi 1 Introduction 1 1.1 Motivation . 1 1.2 Objectives . 2 1.3 Operational Contributions . 2 1.4 Overview . 3 2 Proposed Methodology 5 2.1 Introduction . 5 2.2 Hardware . 5 2.3 Software . 6 2.4 Character Recognition . 6 2.5 Conclusion . 6 v CONTENTS vi 3 Literature Study 7 3.1 Introduction . 7 3.2 Bulk Water Meters . 7 3.3 Character Recognition Software . 9 3.4 Tesseract In Depth . 14 3.5 Conclusion . 17 4 Implementation Outline 18 4.1 Introduction . 18 4.2 Image Procurement . 18 4.3 Rectangle Detection . 21 4.4 Image Enhancement . 22 4.5 Character Extraction . 24 4.6 Character Recognition . 27 4.7 Conclusion . 29 5 Detailed Work 30 5.1 Introduction . 30 5.2 Image Capturing . 30 5.3 Histogram Modification . 35 5.4 Region Growing . 36 5.5 Centreline Approximation . 38 5.6 Region Filtering . 40 5.7 Conclusion . 44 6 Implementation Problems 45 6.1 Introduction . 45 6.2 Rectangle Detection . 45 6.3 Image Enhancement . 46 CONTENTS vii 6.4 Character Extraction . 48 6.5 Conclusion . 50 7 Experimental Investigation 52 7.1 Introduction . 52 7.2 Motivation . 52 7.3 Setup . 53 7.4 Test 1: Median Filter . 54 7.5 Test 2: Histogram Normalisation . 55 7.6 Test 3: Tesseract Accuracy I . 56 7.7 Test 4: Tesseract Accuracy II . 62 7.8 Conclusion . 66 8 Conclusion 67 8.1 Conclusion . 67 8.2 Overview of the Project and Operational Contributions . 68 8.3 Future Work . 69 Appendices 70 A Program Code (CD) 71 List of References 72 List of Figures 3.1 The Proline Promag 10H digital flow meter. 8 3.2 The OPTO Pulser installed on a bulk water meter. 9 4.1 The process of transmitting the image from the bulk water meter to the central server. 19 4.2 The process of capturing an image and uploading it from the device to an FTP server. 20 4.3 High contrast border around meter dials. 21 4.4 Cropped image after rectangle detection. 22 4.5 Example of a 3x3 median filter. The m indicates the median value. 23 4.6 Image before applying smoothing. 23 4.7 Image after applying smoothing. 23 4.8 Image before applying thresholding. 24 4.9 Image after applying thresholding. 24 4.10 Meter dials with two region growing lines illustrated as well as regions found. 25 4.11 Image before extracting numbers. 26 4.12 Reconstructed image. 27 4.13 A part of the training image used for Tesseract. 28 5.1 A block diagram showing how the COMedia UART camera is connected to the Wavecom processor. 31 viii LIST OF FIGURES ix 5.2 The physical setup of the block diagram in figure 5.1. 31 5.3 A close-up image of the development board. 32 5.4 A typical command exchange between the controller and the camera. 34 5.5 The image and image histogram before normalization. 35 5.6 The image and image histogram after normalization. 36 5.7 How pixels adjacent to the centre pixel are numbered. 37 5.8 How the initial pixel is determined, the first step. 38 5.9 How the initial pixel is determined, the second step. 38 5.10 Image showing the spacing between regions and the widths of regions. 39 5.11 Centrelines illustrated. 40 5.12 The meter dials after thresholding in case 1. 40 5.13 The meter dials after thresholding in case 2. 42 5.14 The meter dials after thresholding in case 3. 42 5.15 The meter dials after thresholding in case 4. 43 5.16 The meter dials after thresholding in case 5. 43 6.1 Example of number extraction with the radon transform. 49 7.1 The device setup for capturing images. 53 7.2 A thresholded image where the median filter was applied in the previous step. 54 7.3 A thresholded image where the median filter was not applied in the previous step. 55 List of Tables 4.1 Half-numbers and the corresponding letters that Tesseract outputs when the number is found. 28 5.1 The estimated implementation costs. 33 7.1 Results from case 1. Dial images and character recognition outputs are displayed. 58 7.2 Results from case 2. Dial images and character recognition outputs are displayed. 59 7.3 Results from case 3. Dial images and character recognition outputs are displayed. 60 7.4 Results from case 4. Dial images and character recognition outputs are displayed. 61 7.5 Results from case 3 version 2. Dial images and character recognition outputs are displayed. 64 7.6 Results from case 4 version 2. Dial images and character recognition outputs are displayed. 65 x List of Appreviations CMOS Complementary Metal Oxide Semiconductor FTP File Transfer Protocol GSM Global System for Mobile Communications GUI Graphical User Interface LED Light Emitting Diode OCR Optical Character Recognition OpenCV Open Computer Vision UART Universal Asynchronous Receiver/Transmitter xi Chapter 1 Introduction 1.1 Motivation The project was prompted by a request from Cape Town Municipality for a more efficient way obtain bulk water meter readings. Accurate meter readings are required by the Municipality in order to accurately bill water usage, especially where large quantities of water.