Author: Amrish Kumar
Ever wished to capture your imagination by simply waving your finger in the air? Air Canvas ML brings your drawings to life, using real-time computer vision and machine learning to let you sketch in mid-air. No touchโjust gestures!
- Python: Fast prototyping, huge ecosystem for CV/ML.
- OpenCV: Robust, industry-standard for real-time image/video processing and UI overlays.
- MediaPipe: Google's advanced hand tracking framework, efficient and easy for gesture recognition.
- NumPy: High-performance numerical operations for image arrays.
- collections.deque: Fast and memory-efficient storage for stroke points.
Combining these, we deliver a smooth, interactive experience for air drawing!
-
Modern Dark Mode Canvas
Enhanced visibility and style for your sketches. -
Sleek, Rounded Color Buttons with Live Highlight
Intuitive color selection with animated borders, emoji icons, and easy visual feedback. -
Clear Button with Animated Trash Icon
Instantly erase your canvas with a single gesture. -
Real-Time Hand Tracking Overlay
See your detected hand landmarks live as a semi-transparent guide. -
Dynamic Gesture Hints & Instructions
Always know how to interactโhelpful overlays guide you. -
Undo/Redo (optional)
Go back and forth between recent strokes.
Air Canvas ML uses intelligent hand landmark tracking (via MediaPipe) to identify four main gestures:
| Gesture | How it Works |
|---|---|
| Draw | Track the tip of the index finger (landmark 8). If away from thumb, record movement. |
| Pause (Lift) | Thumb (landmark 4) close to index tip vertically (<30px): stops drawing, starts new stroke |
| Select Color | Move fingertip into any top-bar zone: - Blue: 160-255px - Green: 275-370px - Red: 390-485px - Yellow: 505-600px |
| Clear | Move fingertip into "Clear" button zone (40-140px): all strokes reset, canvas erased |
| Button | Action | Emoji/Icon |
|---|---|---|
| Blue | Draw Blue | ๐ฆ |
| Green | Draw Green | ๐ฉ |
| Red | Draw Red | ๐ฅ |
| Yellow | Draw Yellow | ๐จ |
| Clear | Erase Canvas | ๐๏ธ |
Current color is highlighted with a bright border!
pip install -r requirements.txtpython air canvas ml.pyPress Q to exit.
See requirements.txt for full details:
opencv-python
mediapipe
numpy
MIT
Questions, feedback, or want to collaborate?
Find me on GitHub: Coderamrish
Bring your imagination to lifeโdraw without boundaries!
