π¨ AI Hand Painter β Draw with Your Hand! ποΈποΈ
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! π
π Features
- ποΈ Draw using your hand β Detects index finger and draws in real-time.
- π¨ Dynamic canvas β Canvas automatically matches your webcam resolution.
- β»οΈ Clear the canvas β Press
C anytime to clear your drawings.
- β Exit easily β Press
Q to quit.
- π§ Intelligent finger tracking powered by MediaPipe Hands.
π Project File
ai_hand_painter.py β main script that runs the AI hand drawing app.
π§° Requirements
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
βΆοΈ How to Run
- 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
π§© How It Works
- 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().
β¨ Future Enhancements
- ποΈ 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
β οΈ Troubleshooting
- β β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 using pip install mediapipe.
π§ Credits
Built using:
π License
MIT License Β© 2025 β Feel free to use, modify, and share! π
π§ βWhere AI meets creativity β One hand at a time.β