Iron Canvas Pro is a futuristic air drawing application that lets you paint in the air using just your hand gestures! Draw, sketch, and create with pinch gestures detected through your webcam - no physical tools required.
๐๏ธ Hand Gesture Detection - Uses MediaPipe for accurate real-time hand tracking
โ๏ธ Pinch to Draw - Bring your thumb and index finger together to draw
๐จ Arc Color Palette - Beautiful semi-circle color picker at the top of the screen
๐ Neon Glow Effects - Smooth neon glow on your drawings
๐ต Audio Feedback - Dynamic sound effects based on drawing speed (Windows only)
๐ฏ Sci-Fi HUD - Futuristic heads-up display showing hand skeleton and pinch indicator
๐งน Clear Canvas - Built-in eraser option to clear your artwork
โก Smooth Movement - Configurable smoothing for stable drawing
- Run the application
- Show your hand to the camera (palm facing the camera)
- Hover over the arc palette at the top to see colors
- Pinch (touch thumb to index finger) to select a color
- Move below the palette and pinch again to draw
- Release the pinch to stop drawing
- Select "CLEAR" from the palette to erase everything
- Press 'q' to quit
| Gesture | Action |
|---|---|
| ๐ Index finger up | Control the cursor |
| ๐ค Pinch (thumb + index) | Draw or select color |
| ๐๏ธ Open hand | Stop drawing |
| ๐จ Pinch over palette | Change color or clear canvas |
- Python 3.8 or higher
- Webcam
- Windows OS (for sound effects - optional)
- Clone or download the file
# Download canvas.py to your computer- Install required packages
pip install opencv-python mediapipe numpy- Run the application
python canvas.pypip install opencv-python==4.8.0
pip install mediapipe==0.10.0
pip install numpy==1.24.0Or install all at once:
pip install opencv-python mediapipe numpyYou can customize the application by modifying the Config class:
class Config:
WIDTH, HEIGHT = 1280, 720 # Window resolution
PINCH_THRESHOLD = 40 # Sensitivity (lower = more sensitive)
SMOOTHING = 0.6 # Movement smoothing (0.0 - 1.0)
BRUSH_SIZE = 8 # Drawing brush thickness
NEON_GLOW = True # Enable/disable glow effect
ARC_RADIUS = 150 # Color palette arc radius
ARC_THICKNESS = 60 # Color palette thicknessIf drawing is too sensitive:
PINCH_THRESHOLD = 50 # Increase this valueIf drawing is not responsive enough:
PINCH_THRESHOLD = 30 # Decrease this valueFor smoother but slightly laggy drawing:
SMOOTHING = 0.4 # Lower valueFor faster but jittery drawing:
SMOOTHING = 0.8 # Higher valueThe arc palette includes:
- ๐ด Red
- ๐ Orange
- ๐ก Yellow
- ๐ข Green
- ๐ต Cyan
- ๐ฃ Purple
- โช White
- ๐งน Clear (erases canvas)
-
Hand Detection
- Uses MediaPipe Hands solution
- Detects 21 hand landmarks in real-time
- Tracks index finger (landmark 8) and thumb (landmark 4)
-
Pinch Detection
- Calculates distance between thumb tip and index finger tip
- Pinch detected when distance < threshold (default: 40 pixels)
-
Drawing System
- Smooth cursor position using exponential smoothing
- Lines drawn between consecutive positions
- Neon glow effect using Gaussian blur
-
Color Palette
- Arc-shaped UI at top of screen
- Hover detection using angle calculation
- Selection by pinching over desired color
-
Audio Feedback (Windows only)
- Sound frequency changes based on drawing velocity
- Runs in separate thread to avoid blocking
- Automatically falls back if not available
โโโโโโโโโโโโโโโ
โ Camera โ
โ Input โ
โโโโโโโโฌโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโ
โ MediaPipe โ
โHand Trackingโ
โโโโโโโโฌโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โ Hand System โโโโโโโถโ Canvas โ
โ (HUD) โ โ (Drawing) โ
โโโโโโโโฌโโโโโโโ โโโโโโโโฌโโโโโโโโ
โ โ
โผ โผ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
โArc Palette โ โ Neon Glow โ
โ Selection โ โ Effect โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโ
- Real-time hand tracking using MediaPipe
- 21 landmark points detection
- Sci-fi styled HUD overlay
- Joint connections visualization
- Pinch distance indicator bar
- 8 color options in semi-circle
- Hover highlight effect
- Color name display on hover
- Selection feedback with white ring
- Smooth line drawing with anti-aliasing
- Configurable brush size
- Movement-based line thickness
- Neon glow post-processing
- Velocity-based frequency modulation
- Non-blocking threaded audio
- Graceful fallback on non-Windows systems
- FPS: 30-60 (depends on camera and CPU)
- Latency: ~30-50ms hand tracking
- CPU Usage: ~15-25% on modern processors
- Memory: ~200-300 MB
# Try different camera index
cap = cv2.VideoCapture(1) # or 2, 3, etc.- Ensure good lighting
- Keep hand within camera frame
- Try adjusting
min_detection_confidence:
self.hands = self.mp_hands.Hands(
min_detection_confidence=0.5, # Lower for easier detection
min_tracking_confidence=0.3
)# Increase smoothing
SMOOTHING = 0.4 # Lower = smoother# Decrease smoothing
SMOOTHING = 0.8 # Higher = more responsive- Sound only works on Windows
- Install winsound (usually pre-installed)
- Application will work fine without sound
- Reduce resolution:
WIDTH, HEIGHT = 640, 480- Disable glow effect:
NEON_GLOW = False- Position your hand 1-2 feet from camera for best tracking
- Use good lighting - avoid backlit situations
- Keep hand still when selecting colors
- Draw in smooth motions for best results
- Practice pinch gesture - don't press too hard
- Use smooth, flowing movements
- Vary your drawing speed for different effects
- Mix colors by drawing over previous lines
- Use the glow effect for ethereal designs
Add your own colors to the palette:
self.colors = [
((0, 0, 255), "RED"),
((128, 0, 128), "CUSTOM"), # Add custom color
# ... more colors
]Modify drawing style:
# Thicker brush
Config.BRUSH_SIZE = 12
# Dotted style (in drawing logic)
cv2.circle(canvas, (cx, cy), Config.BRUSH_SIZE, color, -1)Customize the heads-up display colors:
# In draw_sci_fi_hud method
cv2.circle(overlay, pt, 3, (255, 0, 0), -1) # Red joints
cv2.line(overlay, pt1, pt2, (0, 255, 0), 1) # Green lines- Multiple brush styles (spray, pencil, marker)
- Undo/Redo functionality
- Save drawings as images
- Adjustable brush size with gestures
- Two-hand drawing support
- Shape recognition (circles, squares)
- Layer system
- Background image selection
- Recording drawing as video
- Export to SVG format
- ๐ Education - Teaching, presentations, remote learning
- ๐จ Art - Digital sketching, concept art, doodling
- ๐ฎ Gaming - Gesture-based game controls
- ๐ Presentations - Live annotations during talks
- ๐งฉ Fun - Creative play, party entertainment
- โฟ Accessibility - Touch-free interaction
canvas.py
โโโ Config # Configuration settings
โโโ SoundEngine # Audio feedback system
โ โโโ set_drawing() # Update drawing state
โ โโโ _loop() # Background audio thread
โโโ HandSystem # Hand tracking and HUD
โ โโโ process() # Extract hand landmarks
โ โโโ draw_sci_fi_hud() # Render HUD overlay
โโโ ArcPalette # Color picker UI
โ โโโ draw() # Render and detect selection
โโโ main() # Application loop
โโโ Video capture
โโโ Hand processing
โโโ Drawing logic
โโโ Display rendering
- No data collection - everything runs locally
- No internet required - fully offline
- Camera access - only during runtime
- No file creation - unless you save screenshots
This project is open source and available under the MIT License.
- MediaPipe - Hand tracking solution
- OpenCV - Computer vision library
- Inspired by futuristic UI designs and gesture interfaces
Shubroto Das
- GitHub: @ShubrotoDas10
Having issues? Try these resources:
- Check the troubleshooting section above
- Ensure all dependencies are installed correctly
- Verify your webcam is working
- Check Python version (3.8+ required)
# Install dependencies
pip install opencv-python mediapipe numpy
# Run application
python canvas.py
# Quit application
Press 'q' key[Camera View] โ [Hand Detection] โ [Drawing Canvas]
โ
[Arc Color Palette]
Made with โค๏ธ by Shubroto Das
Draw in the air, create with gestures! โจ