A real-time gesture-based HCI system using MediaPipe hand tracking, trajectory analysis, and a hybrid Random Forest + Dynamic Time Warping recognition pipeline.
98.88% air-writing accuracy · 33.6 FPS · CPU-only execution · No specialised hardware required
- ✍️ Real-time air-writing recognition (A–Z)
- 🖱️ Gesture-controlled virtual mouse
- 🎨 Transparent desktop drawing overlay
- ⌨️ Gesture-controlled on-screen keyboard
- 🎵 Virtual piano, guitar, and violin interaction
- ⚡ Real-time system shortcut gestures
- 🧠 Hybrid RF + DTW recognition pipeline
- 📦 CPU-only execution — no GPU required
- 🖨️ STL / OBJ 3D export from drawings
- 🔒 User handover / lock protection system
Air Gesture HMI is a touchless human-computer interaction system that translates mid-air hand gestures into real-time desktop interaction using computer vision and machine learning.
The system combines:
- MediaPipe Hands for 21-point 3D hand landmark tracking
- Rule-based gesture recognition for interaction control
- Random Forest classification for air-writing recognition
- Dynamic Time Warping (DTW) for trajectory similarity matching
- Real-time desktop interaction using PyAutoGUI, Pynput, and Win32 APIs
The application runs entirely on CPU using a standard webcam.
| Metric | Value |
|---|---|
| Letter recognition accuracy | 98.88% |
| Letter classes | 26 (A–Z) |
| Random Forest estimators | 200 |
| Feature count | 13 |
| Average FPS | 33.6 FPS |
| Average latency | 29.7 ms |
| Runtime hardware | CPU only |
| GPU required | ❌ No |
- Windows 11 (64-bit)
- Python 3.10
- Standard USB webcam
- CPU-only execution
Webcam Feed
↓
MediaPipe Hand Tracking
↓
21 Landmark Extraction
↓
Gesture / Trajectory Analysis
↓
RF + DTW Recognition Pipeline
↓
Mode Router
↓
Desktop Interaction / Audio / 3D Export
git clone https://github.com/Sidharths916/air-gesture-hmi.git
cd air-gesture-hmipy -3.10 -m venv venv
venv\Scripts\activatepip install --upgrade pip setuptools wheel
pip install -r requirements.txtExtract:
models/letter_recognizer.zip
inside the models/ directory.
Final structure:
models/
└── letter_recognizer.pkl
python main.py| Category | Technologies |
|---|---|
| Computer Vision | OpenCV, MediaPipe |
| Machine Learning | Scikit-learn, Random Forest, DTW |
| Interaction Layer | PyAutoGUI, Pynput, PyWin32 |
| Audio | pygame, scipy |
| Rendering | OpenCV overlays, Win32 transparency |
| Language | Python 3.10 |
air-gesture-hmi/
│
├── main.py
├── piano_FINALv4.py
├── guitar_FINALv4.py
├── violin_REFACTOREDv2.py
│
├── assets/
├── data/
├── models/
│ └── letter_recognizer.zip
│
├── config.json
├── requirements.txt
└── README.md
Transparent desktop drawing overlay featuring:
- fingertip drawing
- colour switching
- eraser support
- STL / OBJ export
- anaglyph rendering
- PNG
- STL
- OBJ + MTL + texture PNG
- Anaglyph 3D image
| Gesture | Action |
|---|---|
| ☝️ 1 finger | Draw with current colour |
| ✌️ 2 fingers | Cycle to next colour |
| 🤟 3 fingers | Save drawing |
| 4 fingers | Clear canvas |
| 🤙 Pinky | Toggle eraser |
| 🖐️ Palm | Return to main menu |
Real-time air-writing recognition system.
- Trajectory capture
- Stroke normalisation
- Feature extraction
- Random Forest classification
- DTW template matching
- Score fusion
- Keyboard output
- 13 handcrafted geometric features
- 64-point trajectory resampling
- confidence threshold filtering
- DTW similarity comparison
| Gesture | Action |
|---|---|
| ☝️ 1 finger | Draw character stroke |
| Hold still | Recognise and type character |
| ✌️ 2 fingers | Space |
| 🤟 3 fingers | Backspace |
| 4 fingers | Clear stroke |
| 🖐️ Palm | Return to main menu |
Gesture-controlled virtual mouse system.
- cursor movement
- left click
- right click
- drag / hold
- scroll up/down
| Gesture | Action |
|---|---|
| ☝️ Index only | Move cursor |
| 💍 Ring only | Left click |
| 🤙 Pinky only | Right click |
| ✊ Fist | Toggle drag |
| ✌️ 2 fingers | Scroll up |
| 🤟 3 fingers | Scroll down |
| 🖐️ Palm | Return to main menu |
Transparent gesture-controlled virtual keyboard.
- fullscreen overlay
- hover interaction
- Z-depth press detection
- static & dynamic modes
- modifier key support
| Gesture | Action |
|---|---|
| Hover + push forward | Press key |
| Hover over MODE | Toggle input mode |
| 🖐️ Palm | Return to main menu |
Gesture-controlled virtual instruments.
- 🎹 Piano
- 🎸 Guitar
- 🎻 Violin
- synthesized tones
- harmonic layering
- ADSR shaping
- chord detection
| Gesture | Action |
|---|---|
| ☝️ 1 finger | Piano |
| ✌️ 2 fingers | Guitar |
| 🤟 3 fingers | Violin |
| 🖐️ Palm | Return to main menu |
| Gesture | Action |
|---|---|
| 👍 | Free play |
| 👌 | Song selection |
| 🖐️ Palm | Cancel |
Maps gestures directly to system shortcuts.
| Gesture | Action |
|---|---|
| 👍 | Screenshot |
| 👌 | Save file |
| ✌️ | Alt + Tab |
| 🤟 | Zoom in |
| 🤙 | Browser back |
Basic user handover detection system using torso colour verification.
- user verification
- auto-lock on mismatch
- auto-unlock on return
- manual recalibration
| Action | Trigger |
|---|---|
| Auto-lock | Different user detected |
| Auto-unlock | Original user returns |
| Manual recalibration | Hold ✊ Fist |
| Force recalibration | Press U key |
MediaPipe Hands extracts 21 3D landmarks per frame.
Each trajectory is:
- centroid normalised
- unit scaled
- resampled to 64 points
13 geometric features are extracted including:
- aspect ratio
- path length
- curvature
- spatial density
- start/end coordinates
A 200-tree Random Forest predicts class probabilities.
Dynamic Time Warping compares trajectory similarity against stored templates.
RF probability and DTW similarity scores are fused for final prediction.
Final accuracy achieved: 98.88% across all 26 letters (A–Z)
- Windows 10 / 11
- Python 3.10
- Standard webcam
- CPU-only execution
| Library | Purpose |
|---|---|
| OpenCV | Computer vision & rendering |
| MediaPipe | Hand landmark tracking |
| Scikit-learn | Random Forest classifier |
| pygame | Audio engine |
| scipy | Signal filtering |
| pyautogui | Mouse & keyboard control |
| pynput | System input simulation |
| pywin32 | Transparent overlays |
mediapipe==0.10.14andscikit-learn==1.3.2are intentionally pinned for compatibility.
| Key | Action |
|---|---|
| ESC | Exit application |
| U | Recalibrate user |
| R | Reset camera |
| H | Toggle skeleton overlay |
| M | Toggle mirror mode |
| S | Toggle sound |
| F | Toggle FPS display |
- Initial startup latency during MediaPipe warm-up
- Transparent overlays are Windows-dependent
- First camera frame may briefly spike in latency
- Multi-hand support
- Linux/macOS support
- CNN-based recognition comparison
- Mobile deployment
- Custom gesture recording
- Embedded deployment
@misc{airgesturehmi2026,
author = {Sidharth S},
title = {Air Gesture HMI: Real-Time Multimodal Gesture-Controlled Human-Computer Interaction System},
year = {2026},
publisher = {GitHub},
url = {https://github.com/Sidharths916/air-gesture-hmi}
}Licensed under the MIT License.
- MediaPipe by Google
- OpenCV
- pygame
- scikit-learn





