[Edinburgh-pm] OT Image Analysis / OCR

Murray perl at minty.org
Fri Oct 1 14:39:18 PDT 2010


Hope heretic was fun :)

I'm at a bit of a loss where to start on this, so any suggestions
welcome.  It's basically an image processing and OCR problem.

A while back I got an electricity meter -- it measures the total
household usage, requires no wiring and can be plugged into a computer
for fun graphing applications.  I'd highly recommend them.

    http://www.currentcost.com/ (I have an older model)

Fwiw, we avg ~10 kWh/day, or roughly about £1/day.

Then I realised that saving electricity is all well and good, but it's a
relatively small fraction of our energy usage.  Gas being the big
elephant in the room (mainly for heating).

So I'd like to measure our gas usage, daily or preferably hourly.

Unless someone knows of a no-hassle, no-pipework gas monitor, I hit upon
the wheeze of getting a cheap webcam [1] and placing it in front of the
gas meter and capturing an image.  Here are a couple of test samples:

    http://minty.org/gas/a.png

    http://minty.org/gas/b.png

I've cropped the pictures to show just the meter.

Basically the problem is how do I convert those into "6500" or better
"6500.96".  Bonus marks for additionally converting the red arrow/dial
(although I suspect that might actually be easier).

The best I've found so far open source ocr is
http://code.google.com/p/tesseract-ocr/

I'm not entirely against just running a brute force approach in
Perl using known tiles and looking for "fuzzy" but likely matches.

But I'm wondering if anyone has a smarter idea?

Some points of note:

- I can "fix" the camera, but as the cupboard is used periodically for
  storage, there is always a chance of a small knock.  It'd be best to
  assume the camera position will move a small amount over time, but can
  be (roughly) hand-calibrated easily enough.

- The meter has a glass front, causing horribly lens glare if the camera
  & it's led lights are placed straight on.  Thus, the image is slightly
  skewed due to the camera being off-center.  I could go up/down, left
  or right.  It's in a dark cupboard with no other constant light source.

- Between the "65" and the "00" is a chip in the glass.  For this
  reason, positioning the camera to the left works better than to the
  right.  Similarly, I'd imaging down would work better than up.

- Worst case is automatic daily image capture and a yearly manual job of
  running through 365 images and re-keying the meter reading.  But
  hourly would be a lot more fun, and that is probably beyond my
  re-keying capacity.

Taking a weekly reading by hand and averaging over 7 days would be a
decent approximation.  However I'd like to log temperature too.  I can
get a close outside temp from the BBC [2] and the CurrentCost device
logs the room temp.  So a weekly average would loose a good amount of
fidelity.

Suggestions?

[1] http://amzn.to/9OrpWW and I can confirm it works flawlessly on
ubuntu and mac os x without needing any drivers.  Truely plug n play.
Only downside is you can't control the leds (or focus, or position) via
the computer, but hey, they're leds, so we can leave them on all the
time.

A pending task is to measure the power consumption of the computer when
idle with the camera plugged in and leds on, vs camera unplugged.

[2] http://backstage.bbc.co.uk/data/WeatherFeeds?v=151i


More information about the Edinburgh-pm mailing list