A fun and interactive real-time hand drawing app built using OpenCV, NumPy, and MediaPipe.
Move your index finger in the air to draw — no mouse required! 🚀
- 🖐️ Draw using your hand — Detects index finger and draws in real-time.
- 🎨 Dynamic canvas — Canvas automatically matches your webcam resolution.
- ♻️ Clear the canvas — Press
Canytime to clear your drawings. - ❌ Exit easily — Press
Qto quit. - 🧠 Intelligent finger tracking powered by MediaPipe Hands.
ai_hand_painter.py— main script that runs the AI hand drawing app.
Make sure you have the following Python libraries installed:
pip install opencv-python mediapipe numpy💡 If installation fails, try upgrading pip:
pip install --upgrade pip
- Connect your webcam.
- Open a terminal or VS Code terminal in your project folder.
- Run the script:
python ai_hand_painter.py- Controls:
- 🧽 Press C → Clear the canvas
- 🚪 Press Q → Quit the program
- Webcam Feed: Captures video using OpenCV.
- Hand Detection: MediaPipe detects 21 hand landmarks.
- Finger Tracking: Detects which fingers are up using custom logic.
- Drawing Mode:
- If only the index finger is up, it draws on the canvas.
- If multiple fingers are up, drawing stops.
- Canvas Merge: Blends live camera feed with your drawn strokes using
cv2.addWeighted().
- 🖍️ Color palette for multiple pen colors
- 🧽 Eraser mode
- 📸 Save drawing as image file
- 🔊 Add voice commands for color and size control
- 🖼️ GUI interface with brush size slider
- ❌ "Cannot access camera":
Make sure your webcam is not used by another app. ⚠️ "Camera read failed":
Try restarting your computer or checking permissions.- 🧱 mediapipe not found:
Reinstall mediapipe usingpip install mediapipe.
Built using:
- 🧰 OpenCV — for image processing
- ✋ MediaPipe Hands — for real-time hand tracking
- 🔢 NumPy — for array manipulation
MIT License © 2025 — Feel free to use, modify, and share! 💚
Amit Kadam — AI & Python Enthusiast
📧 kadamamit462@gmail.com
🌐 GitHub: @piyushkadam96k
🧠 "Where AI meets creativity — One hand at a time."