A touchless human-computer interaction system that lets you write and draw in the air using only your finger and a webcam — no mouse, no stylus, no touch required.
cd VirtualAir
pip install -r requirements.txtpython virtual_air_writer.py| Gesture | Fingers Up | Action |
|---|---|---|
| ☝️ Index finger | Index only | Draw on canvas |
| ✌️ Peace sign | Index + Middle | Select color (move to palette) |
| 🖐️ Three fingers | Index + Middle + Ring | Erase (partial) |
| ✋ Open hand | All 5 fingers | Clear entire canvas |
| 👍 Thumbs up | Thumb only | Save drawing |
| Key | Action |
|---|---|
S |
Save drawing |
C |
Clear canvas |
Q |
Quit |
6 built-in colors — hover your ✌️ (Index + Middle) fingers over the swatches in the header to select:
| Color | Hex |
|---|---|
| Sky Blue | #34B4EB |
| Neon Green | #32E650 |
| Hot Pink | #F532C8 |
| Gold | #FFD21E |
| White | #FFFFFF |
| Cyan | #32DCFF |
virtual_air_writer.py
├── HandDetector → MediaPipe wrapper (21 landmarks)
├── GestureRecognizer → Maps finger states → gesture names
├── Canvas → NumPy drawing layer + save/erase
└── UIRenderer → HUD overlay (header, toasts, labels)
Saved files are stored in ./saved_drawings/ with timestamped filenames:
saved_drawings/
└── drawing_20260413_214132.png
- Python 3.9+
- Webcam (USB or built-in)
opencv-python,mediapipe,numpy
Edit at the top of virtual_air_writer.py:
BRUSH_THICKNESS = 8 # Stroke width
ERASER_THICKNESS = 60 # Eraser radius
SMOOTHING_BUFFER = 6 # Larger = smoother but more lag
MIN_DIST = 5 # Min px to register new point