Analog Mater Reader using OpenCV/Python
- Read image from a configured video stream (e.g. local webcam)
- Find circles using Hough Circles (currently with pre-defined radius range)
- Find circles which are roughly on the same level
- If a predefined number of circles is found, continue... otherwise start over
- For each circle, find the needle orientation (angle and corresponding value 0-9)
- Divide the circle into N sections (currently hard-coded to 40, so we get 40 angles)
- For each angle, start from the centre of the circle and count number of continuous dark pixels
- The angle with the highest number of continuous dark pixels is (probably) where is the (presumably dark) needle
- Determine the orientation of the dial (CW - clockwise or CCW - counter clockwise... currently hard-coded) to get the actual reading
- "Fix" the readings... i.e. if the first value is 7.0 and the next value is 5.75, the first value should actually be 6.x. This is to fix the incorrect reading caused by the position of the camera (e.g. pointing upwards, so 6.9 looks like 7.0).
- Python 3
- Install Python virtual environment
- Install Python dependencies with
pip install
.
Copy the config-sample.ini
to config.ini
, update it accordingly.
Run python run.py
.
- Computer with Python3
- Web cam connected to a home router. I've used a cheap POE camera from Aliexpress, so that I could connect it via cable and also access it via HTTP/RTSP protocol. The camera however tried to ping/send requests to some dodgy domain, so I've blocked that on my router and only allowed secure local access. (I don't want random people to see my meter readings ;-))
- Raspberry Pi Zero W (WIP - I'm trying to get the code run on it)
- https://appsource.microsoft.com/en-us/product/web-apps/clockworksdatainnovationbv.clockworks-meter-reader?tab=overview
- https://github.com/davidpadbury/power-meter-reader
- https://github.com/arjun372/Analog-Utility-Meter-Reader
- https://blogs.gnome.org/jsparber/2020/01/18/digitizing-a-analog-water-meter/
- https://github.com/intel-iot-devkit/python-cv-samples/tree/master/examples/analog-gauge-reader
- https://stackoverflow.com/questions/20891936/rtsp-stream-and-opencv-python
- Markdown
- Python
- OpenCV