Skip to main content

Convert images of analog gauge to readings

Project description

README

pypi downloads/month

Ever stared at an old analog gauge - like that dusty water meter in your basement - and wished you could convert its indicators into actionable data?

ppf.angauge (pronounced like "engage") to the rescue: It converts photos of your gauge to digital readings. It handles

  • meters with a single indicator showing an analog value (like an ammeter or the gauge in the logo)
  • meters having multiple indicators each showing a digit [0, 10) of the actual reading (like the water meter shown below).

Note: It reads indicators (hands rotating in front of dials). It does not read registers (rotating drums with printed digits).

It provides:

  • a python package to integrate into your own projects
  • a command line tool for quick testing and prototyping

Isn't this very similar to "AI-on-the-edge"? It is. In fact, if you are looking for a firmware to run on an esp32-cam board, you are better off using that project. If you are working on a different platform, if you want the flexibility to integrate with your own (python) code, or if you are reading value-indicators (not digit-indicators), keep reading.

Usage

The command-line tool works as follows:

> read_gauge <config.toml> <image.bmp>
image.bmp, 0.5632

where config.toml is a configuration file specifying location, size, and orientation of the indicators in image.bmp, which we will explain in a second. For more information on command line options, see read_gauge --help.

The following code snippet shows how to do the same in python:

from ppf.angauge import read_config, read_gauge, mle
from matplotlib.pyplot import imread

# read configuration file:
config = read_config('config.toml')

# read image:
img = imread('image.jpg')

# read meter hands from image:
readings = read_gauge(img, config)

# determine most likely meter state given readings:
value, errorbar = mle(readings)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ppf_angauge-0.1.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file ppf_angauge-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ppf_angauge-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.11

File hashes

Hashes for ppf_angauge-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5eedbeff90b9181eb6af788630f61cbf9df1ae03797faa9bc3c2afa982907b1
MD5 f3ae09c1e300db4ae5913f56daee2cdd
BLAKE2b-256 9311bf2cc7a0334d063c6cc9caad421cc71379c1a296520cc27babb80c1f8825

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page