Skip to main content

A lightweight hand gesture recognition engine

Project description

Hand Gesture Engine

A modular, extensible hand gesture recognition engine built in Python using MediaPipe landmarks. Designed for real-time applications, clean architecture, and easy integration into games, apps, and AI projects.

Features

  • Modular gesture detection system
  • Real-time hand landmark processing
  • Centralized gesture recognizer (brain logic)
  • Configurable thresholds (pinch, thumb, etc.)
  • Built-in logging (debug & production ready)
  • CPU / GPU backend auto-selection
  • Clean project structure

Project Structure

.
├── examples/
│ ├── demo.py
│ ├── gesture_game.py
│ └── test.py
├── hand_gesture/
│ ├── assests/
│ │ └── hand_landmarker.task
│ ├── init.py
│ ├── config.py
│ ├── engine.py
│ ├── gesture.py
│ ├── logging_config.py
│ ├── recognizer.py
│ ├── stabilizer.py
│ ├── tracker.py
│ └── utils.py
├── .gitignore
├── pyproject.toml
└── README.md

Supported Gestrues

Gesture Name Returned
✊ Fist FIST
✋ Open Hand OPEN HAND
👍 Thumbs Up THUMBS UP
👎 Thumbs Down THUMBS DOWN
✌ Peace PEACE
☝ Pointing POINTING
👌 OK OK
🤏 Pinch PINCH
🖖 Three Fingers THREE

Installation

pip install mediapipe opencv-python

to clone the repository:

git clone https://github.com/KaranVishwakarma-1807/hand-gesture-engine.git
cd gesture-engine

Basic Usage

from gesture_engine.engine import GestureEngine
from gesture_engine.config import GestureConfig

engine = GestureEngine(
    backend="AUTO",
    config=GestureConfig()
)

gesture, confidence = engine.process(hand_landmarks)

print(gesture, confidence)

Extending Gestures

To add a new gesture:

  • Implement gesture logic in gestures.py
  • Register it in recognizer.py
  • (Optional) Add config parameters

Future Ideas

Roadmap

  • Gesture smoothing
  • Multi-hand support
  • Custom gesture training
  • Mobile optimization
  • ONNX / TensorRT backend

License

MIT License
Free to use, modify, and distribute.

Author

Karan Vishwakarma
Built with Python and Mediapipe(Google)

Credit

https://tree.nathanfriend.com/
Here, you can make you custom project directory trees for the markdown file.
Definietly, check it out, if you want the same.
Very useful!

Quick Start

import cv2
from hand_gesture import GestureEngine, GestureConfig

config = GestureConfig.from_yaml("gesture_config.yaml")
engine = GestureEngine(config=config)

cap = cv2.VideoCapture(0)

while cap.isOpened():
    ret, frame = cap.read()
    if not ret:
        break

    frame, gesture = engine.process(frame)

    if gesture:
        print("Detected:", gesture)

    cv2.imshow("Gesture Engine", frame)
    if cv2.waitKey(1) == 27:
        break

Configuration

backend: AUTO

stability:
  hold_time: 0.35
  min_confidence: 0.6

thresholds:
  pinch: 0.04
  thumb_extended: 0.25
  finger_tolerance: 0.05

Contributing

Pull requests are welcome.
Open an issue for major changes.

Project details


Download files

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

Source Distribution

hand_gesture_engine-0.1.0.tar.gz (5.8 MB view details)

Uploaded Source

Built Distribution

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

hand_gesture_engine-0.1.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file hand_gesture_engine-0.1.0.tar.gz.

File metadata

  • Download URL: hand_gesture_engine-0.1.0.tar.gz
  • Upload date:
  • Size: 5.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for hand_gesture_engine-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b13d4609947b44b1ce5e1b839211bb06b5bf2812afbf067e8866f036a34bc962
MD5 3300c46279c3752a446f263492920cb5
BLAKE2b-256 da55944963911c2dbc4836f96d5060089a8a56b891a0e73bd54ee966f162a5e5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for hand_gesture_engine-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2468780daa17862d940148720d31159f7f2151d7ce36d68da7348d059cbb8a45
MD5 7d9ef4d205dd9e0991efc6e5265191fc
BLAKE2b-256 0f2158d3766723b10af80c8582378391d139b3776bb0a3d7b6395dc88ddb4db4

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