davidpadbury / power-meter-reader

Use OpenCV to read a old power meter
15 stars 5 forks source link

Thank you for sharing! #2

Open esutton opened 3 years ago

esutton commented 3 years ago

I am amazed that a little over 100 lines of python can do this.

I am trying to figure out a couple of issues:

ToDo: 1) Do need to add rules if very close to number, for example 3.9 and next right-dial is past 0, then round-up to 4.0 ? 2) Do need to clean glass on outside and inside? The glass unscrews I think?

Analyze output images

2020-feb-01 hand-edge-0 intersection-0 hand-edge-1 intersection-1 hand-edge-2 intersection-2

pastacolsugo commented 3 years ago

Not the author nor an expert, but I've taken a look at the code and I don't think the haze on your glass is that relevant, the image gets blurred as one of the first steps in the processing. I believe the inaccuracies you are experiencing are because the program is calibrated for his gauge, which has a simpler shape of the arm (needle?). If you want to experiment I believe you could look at line 30 and play around with the threshold, minLineLength and maxLineGap. If you can I suggest you to try out the values with a old images and see if it gets better. Good luck!

esutton commented 3 years ago

@pastacolsugo thank you for the suggestion!

Is the purpose of blurred to remove noise from image? To remove small artifacts such as dirt or reflections?

The dial hand edge detection is hard to understand on the first left-most dial image.

Intersection is about 1 when expected 4. intersection-0

Hand Edge shows a short vertical line at 1 when expected radial line at 4. hand-edge-0

Blurred blurred-0

Edges edges-0

Dial dial-0

I will look at line 30 and Hough Line Transform:

pastacolsugo commented 3 years ago

Yes usually you apply a blur to reduce noise. Maybe you can look into working with only one of the three RGB channels, you can try a binary filter or just increasing contrast. If it's a simple operation you could try to clean out the haze, wouldn't hurt for sure.