Skip to content

aryankumar-04/HandCount-AI

Repository files navigation

HandCount AI Logo

HandCount AI

Real-time, privacy-first Windows desktop app for webcam hand-landmark tracking and 0–10 finger counting.

GitHub Release License: MIT Python Version Platform Tests


📌 Overview

HandCount AI detects your hand(s) through a webcam and counts fingers (0–10) in real time — fully offline, with no data ever leaving your PC. It uses MediaPipe for hand landmark detection and a custom geometry engine for accurate finger-state classification, wrapped in a clean PySide6 desktop UI.

  • 🔒 100% local processing — no internet, no cloud, no telemetry
  • ✋ Supports 1 or 2 hands with correct Left/Right handedness
  • 🎯 Stabilized counting (no flicker) using majority-vote smoothing
  • 🖥️ Simple dashboard, settings, and about pages

📸 Screenshots

Dashboard Settings
Dashboard Settings
About Page Live Tracking
About Live Hand Tracking
Screenshot 2 Screenshot 3
Screenshot 4 Screenshot 5

✨ Features

Feature Description
🎥 Real-time webcam processing Captures and processes video via OpenCV in a background thread
🔢 Finger counting (0–10) Counts fingers across one or two hands simultaneously
✋ Single & dual-hand support Tracks up to 2 hands at once (configurable up to 4)
🖐️ Arbitrary finger combinations Works for any combination of extended/folded fingers
↔️ Left/Right handedness Correctly labels hands even when the preview is mirrored
🦴 Landmark visualization Draws hand skeleton overlay on the live feed
📉 Temporal stabilization Sliding-window majority voting removes count flicker
🪞 Mirrored camera toggle Flip the preview horizontally
📊 FPS display Live frame-rate overlay
⚙️ Adjustable camera settings Resolution, camera index, detection/tracking confidence
🖥️ Dashboard / Settings / About pages Full PySide6 desktop UI
🌐 Offline functionality No internet connection required — model runs locally
🔐 Privacy-first No video is recorded, stored, or uploaded
🛠️ Error handling & recovery Auto frame-read retries with user-friendly error popups

🛠️ Tech Stack

Runtime

  • Python >=3.10 (tested on 3.14.6)
  • PySide6 >=6.5.0 — Qt6 GUI framework
  • OpenCV opencv-python>=4.8.0 — video capture & frame processing
  • MediaPipe >=0.10.0 — hand landmark detection (Tasks API)
  • NumPy >=1.24.0 — geometry & vector math

Development & Build

  • pytest >=7.4.0 — testing (49 tests, all passing)
  • PyInstaller >=6.0.0 — packaging into a standalone Windows app
  • setuptools / wheel — build backend

🧠 How It Works

Webcam Hardware
   │  (OpenCV VideoCapture)
   ▼
CameraWorker (background thread)
   │  (BGR → RGB conversion)
   ▼
MediaPipe Hand Detector
   │  (21 3D joint landmarks per hand)
   ▼
Geometry Engine
   │  (joint angles, distances, finger posture)
   ▼
Finger Counter
   │  (0–10 total finger count)
   ▼
Stabilizer
   │  (majority voting, removes flicker)
   ▼
Renderer + PySide6 UI
   ▼
Your Screen

📂 Project Structure

HandCount-AI/
├── assets/
│   ├── icons/
│   └── models/                # bundled MediaPipe model (offline use)
├── docs/
│   ├── architecture.md
│   ├── privacy.md
│   └── testing.md
├── scripts/
│   └── build_windows.py       # builds the standalone .exe
├── src/handcount/
│   ├── main.py
│   ├── app/                   # app state & lifecycle
│   ├── camera/                # webcam capture worker
│   ├── services/              # config & logging
│   ├── ui/                    # PySide6 pages & widgets
│   └── vision/                # detection, geometry, counting, stabilizer
├── tests/                     # 49 automated tests
├── requirements.txt
├── pyproject.toml
└── LICENSE

🚀 Getting Started

Option 1 — Windows Installer (Recommended) ⭐

The easiest way to install HandCount AI on Windows. No Python or coding knowledge required.

  1. Go to the Releases page.
  2. Download HandCountAI-Setup-v1.0.0.exe.
  3. Double-click the downloaded installer.
  4. Follow the installation wizard.
  5. Launch HandCount AI from the Start Menu or Desktop shortcut.

Note: The installer is currently not code-signed, so Windows may display a SmartScreen or Unknown Publisher warning.


Option 2 — Portable ZIP (No Installation)

Use HandCount AI without installing it.

  1. Go to the Releases page.
  2. Download HandCountAI-v1.0.0-Windows-x64.zip.
  3. Extract the entire ZIP to any folder.
  4. Open the extracted folder.
  5. Double-click HandCountAI.exe.

⚠️ Important: Don't move HandCountAI.exe out of its folder. It requires the bundled files and folders located alongside it to run correctly.


Option 3 — For Developers

Run HandCount AI directly from the source code.

# 1. Clone the repository
git clone https://github.com/aryankumar-04/HandCount-AI.git
cd HandCount-AI

# 2. Create & activate a virtual environment (Windows PowerShell)
python -m venv venv
.\venv\Scripts\Activate.ps1

# 3. Install dependencies
pip install -r requirements.txt

# 4. Run the app
python src/handcount/main.py

# 5. (Optional) Run in debug mode
python src/handcount/main.py --debug

# 6. Run the test suite
python -m pytest

---

## 🔒 Privacy & Security

| Question | Answer |
|---|---|
| Is video recorded to disk? | ❌ No |
| Are frames saved as images? | ❌ No |
| Is anything uploaded online? | ❌ No |
| Are cloud APIs used? | ❌ No |
| Is internet required to run? | ❌ No |
| Is telemetry/analytics collected? | ❌ No |
| Are user accounts required? | ❌ No |

Local files only:
- `%LOCALAPPDATA%\HandCountAI\config.json` — your settings
- `%LOCALAPPDATA%\HandCountAI\logs\handcount.log` — diagnostic logs (auto-redacted, rotates at 5MB)

---

## ✅ Testing

```text
49 passed in 7.49s

Covers: hand geometry & finger-state math, finger counting accuracy, handedness stability, stabilization logic, state machine transitions, config persistence, and UI integration.


💻 System Requirements

  • OS: Windows 10 / 11 (64-bit)
  • Python (dev only): 3.10 – 3.14
  • Webcam: Any standard USB or built-in webcam

📄 License

This project is licensed under the MIT License — see LICENSE for details.


👤 Author

Maintained by aryankumar-04


⭐ If you find this project useful, consider giving it a star!

About

A privacy-first desktop application for real-time hand tracking and finger counting using Python, PySide6, OpenCV, and MediaPipe

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages