Everyone who is experienced in brownfields electrical will have spent time looking through photographs to find wires while trying to as built old drawings. Personally, in the past eighteen months, I’ve spent more time doing it than any sane person should.
There always seems to be that one elusive wire that takes forever to find.
I decided that there had to be an easier way. I wanted to search for text in the photos the same way we search for text in a document. Afterall, text recognition of car number plates is old technology, and wire ferrules do look a lot like tiny car number plates. Could that round technology be driven into a square hole?
From previous experience using python for image classification, I knew it should be a straight forward exercise. I would need to import the image (using OpenCv), convert each piece of text (Using Googles tesseract library), and if the OCR’d text matched the wire number I was looking for, then draw a bounding box around the ferrule (using OpenCV again).
I dusted off out some old projects and cut and paste the code snippets I needed. As a first pass, the results were excellent, the code was able to locate the wires about 80% of the time. By converting the image to grey scale, and playing with the contrast I was able to increase the detection rate to about 90%. However, the photos were not taken with OCR in mind and the camera angle often skewed the text, or the ferrules were facing downwards, and this prevented detection much beyond 90%.
What I found exciting was the scalability of the code, for example if good resolution photos were taken from the appropriate angle and distance for OCR, then the detection rate would start to approach 100%. If each panel was photographed, then thousands of wires could be searched simultaneously, and a wires entire path from the MCC to the field and back again could be shown highlighted. Once a system is built, maintaining it would be as simple as taking a new photograph.
Further development could see the script compare a termination diagram (PDF) against a terminal strip photo, and highlight any discrepancies, or even automatically create the termination diagram (CAD file) from scratch based on the photo.
The script will never replace the checks of an experienced designer or engineer, but it can be used as an aid to speed up the design process.
Using Python as a base means a form style front end could be added and the tool made available for all. Please message if you think this tool is something you could use, or if you would like to see it developed further.