• Version: 20261019
  • Source Code Copyright: Unknown — based on axn170037/Analogue-Gauge-Reader, which declares no license
  • Redistribution Restriction: This source code is integrated by LEADERG INC. Please use it privately. Please DO NOT distribute it to internet.

Console/terminal demo of reading an analog gauge from a photo with classic OpenCV for Windows 11, Ubuntu Linux 24.04 and macOS 14+ (Apple Silicon): Hough circles find the dial, ring contours calibrate the zero/end angles, thresholding + Hough lines find the needle, and the needle angle is mapped to the gauge scale. Six step images go to model/gauge_reader/ and the reading is printed. Headless. CPU only: the pip opencv-python build has no GPU backend (no CUDA, no Apple GPU).

 

[Prerequisites]

  • Python 3.14, installed by 01_python_install_windows.bat / 01_python_install_linux.sh / 01_python_install_mac.sh (Windows: winget; Ubuntu: apt, or the deadsnakes PPA when the Ubuntu archive has no python3.14; macOS: Homebrew).
  • 02_venv_create_windows.bat / 02_venv_create_linux.sh / 02_venv_create_mac.sh create venv/ with Python 3.14 and install numpy, opencv-python, matplotlib and pandas from src/requirements.txt (same packages on every OS).
  • GPU: none. CPU only on every OS, because the pip opencv-python build has no GPU backend (numpy and pandas are CPU libraries); no NVIDIA driver or CUDA is needed.

[Launcher Scripts]

1. 01_python_install_windows.bat / 01_python_install_linux.sh / 01_python_install_mac.sh

Install Python 3.14 (winget / apt or deadsnakes PPA, needs sudo / Homebrew). Skips the install when Python 3.14 is already present. On Windows, open a new terminal afterwards.

 

2. 02_venv_create_windows.bat / 02_venv_create_linux.sh / 02_venv_create_mac.sh

Delete the old venv/, create a fresh one with Python 3.14 and install requirements (numpy, opencv-python, matplotlib, pandas). Aborts loudly if pip fails.

 

3. 03_venv_activate.bat / 03_venv_activate.sh

Activate the venv. On Linux/macOS, source it: source src/03_venv_activate.sh (bash or zsh). If the project folder was renamed after the venv was created, re-create the venv with 02_venv_create_windows/linux/mac first; the other launchers do not need activation.

 

4. 04_gauge_reader.bat / 04_gauge_reader.sh

Read the gauge photo; step images to model/gauge_reader/, reading printed.

 

5. 99_venv_clean.bat / 99_venv_clean.sh

Delete the venv folder.

 

6. 99_venv_deactivate.bat / 99_venv_deactivate.sh

Deactivate the venv in the current shell. On Linux/macOS, source it: source src/99_venv_deactivate.sh (bash or zsh).

[Python Entry Point]

src/gauge_reader.py

[--image data/gauge-1.jpg] [--min-value 0] [--max-value 200] [--diff1-lower 0.15] [--diff1-upper 0.35] [--diff2-lower 0.5] [--diff2-upper 1.0] [--threshold 175] [--output-dir model/gauge_reader]. Runs on the CPU (OpenCV's pip build has no GPU backend); there is no --device option.

[Quick Start]

Windows 11

src\01_python_install_windows.bat

REM open a new terminal

src\02_venv_create_windows.bat

src\04_gauge_reader.bat

 

Ubuntu 24.04

bash src/01_python_install_linux.sh

bash src/02_venv_create_linux.sh

bash src/04_gauge_reader.sh

 

macOS 14+ (Apple Silicon)

bash src/01_python_install_mac.sh

bash src/02_venv_create_mac.sh

bash src/04_gauge_reader.sh

 

This SDK is built in AppForAI - AI Dev Tools.