Your Full Name: Rohan Patil
This project implements a real-time Python application that uses a webcam to detect and recognize a set of static hand gestures. It captures a live video feed, detects and tracks a single hand, extracts landmark-based features, and classifies the current hand pose into one of the supported gestures — all with on-screen feedback and optional recording.
The application recognizes four static gestures:
- Open Palm
- Fist
- Peace Sign (V-sign)
- Thumbs Up
A detected gesture’s name is displayed on the output video window in real time.
- MediaPipe Hands — for hand detection and 21 landmark extraction. Fast and CPU-friendly.
- OpenCV — for webcam capture, drawing overlays, and recording.
- NumPy — for numeric operations (angles, distances, normalization).
- scikit-learn + joblib — optional, for training lightweight classifiers.
Why this stack?
MediaPipe + OpenCV ensures robust, low-latency detection suitable for real-time use while keeping the app lightweight.
- Capture video frames with OpenCV.
- Detect hand and extract landmarks with MediaPipe.
- Normalize landmarks to scale/position.
- Extract features (angles, distances, orientation).
- Apply rules-based classifier:
- Open Palm: all fingers extended.
- Fist: all fingers folded.
- Peace: index & middle extended, others folded.
- Thumbs Up: four fingers folded, thumb extended upwards.
- Smooth predictions with a sliding window + debounce.
- Display gesture name and FPS on screen.
- Optionally record annotated video.
Run each installation command separately:
pip install opencv-python
pip install mediapipe
pip install numpy
pip install scikit-learn
pip install joblibMake sure Python version is 3.8–3.11
Upgrade pip:
python -m pip install --upgrade pippython app.pyq→ quitc→ calibrate (show open palm for 2s)d→ toggle data capture
Recordings are saved in the demo/ folder.
hand-gestures/
├─ src/
│ ├─ app.py # main loop, calibration, recording
│ ├─ features.py # normalization & feature extraction
│ ├─ gestures.py # rules-based classifier with smoothing & calibration
│ └─ utils.py # drawing helpers and FPS meter
├─ demo/
│ └─ recording_YYYYMMDD_HHMMSS.avi
├─ captured_data.csv # optional: features + labels
└─ README.md
A demonstration video is included in the demo/ folder:
demo/demo.mp4If you run the app, an annotated .avi file will also be saved automatically.
- Runs in real-time (>25 FPS on CPU).
- Adjustable smoothing to reduce flicker.
- Works on standard laptop webcam input.
- mediapipe not installing → check Python version (3.8–3.11 only).
- Low FPS → reduce webcam resolution or set
model_complexity=0. - Flickering gestures → increase smoothing window/debounce values.
For improvements or questions:
[email protected]
- Code is modular and organized by functionality.
- Inline comments explain complex or non-obvious logic.
- Functions are named descriptively for readability.
- Python 3.7+
- OpenCV
- MediaPipe
Install dependencies with:
pip install -r requirements.txt"# Real-Time-Static-Hand-Gesture-Recognition"