https://github.com/venkat-0706/air-drawing
A real-time hand gesture drawing app using Python, OpenCV, and MediaPipe to draw, erase, and switch colors on a canvas using finger gestures via webcam.
https://github.com/venkat-0706/air-drawing
computer-vision hand-gesture-recognition mediapipe mediapipe-hands numpy opencv-python python realtime-object-tracker
Last synced: 3 months ago
JSON representation
A real-time hand gesture drawing app using Python, OpenCV, and MediaPipe to draw, erase, and switch colors on a canvas using finger gestures via webcam.
- Host: GitHub
- URL: https://github.com/venkat-0706/air-drawing
- Owner: venkat-0706
- Created: 2025-06-29T14:17:07.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-06-29T14:55:25.000Z (3 months ago)
- Last Synced: 2025-06-29T15:36:44.174Z (3 months ago)
- Topics: computer-vision, hand-gesture-recognition, mediapipe, mediapipe-hands, numpy, opencv-python, python, realtime-object-tracker
- Language: Python
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐จ Hand Gesture Drawing App
> Control your canvas using just your hand.
> **Draw, erase, and switch colors** in real-time using intuitive hand gestures detected via webcam.---



---
## ๐ง Key Features
| Feature | Description |
|------------------------------|-----------------------------------------------------------------------------|
| ๐จ **Air Drawing** | Draw lines on a canvas using your index finger in real-time |
| ๐งผ **Erasing** | Make a fist gesture to erase parts of the drawing |
| ๐ **Color Palette Switching**| Hover over virtual palette to switch between red, green, and blue |
| ๐ฅ๏ธ **Live Feedback UI** | See gestures drawn live on the video stream with MediaPipe hand overlays |
| โก **Smooth Drawing Engine** | High-performance canvas rendering with OpenCV and NumPy |---
## โ Gesture Recognition Logic
| Gesture | Action |
|----------------------------------|-------------------|
| โ๏ธ Index finger up only | Draw |
| โ All fingers down (fist) | Erase |
| โ๏ธ Two fingers up | Color selection |
| ๐๏ธ Open palm | Idle / reset |MediaPipe detects **21 landmarks per hand**. Gesture logic is implemented by comparing fingertip and lower-joint positions to determine finger states.
---
## ๐ง Tech Stack
### ๐งช Core Technologies
| Tech | Role |
|----------------|--------------------------------------------------------|
| **Python 3.7+**| Programming Language |
| **OpenCV** | Webcam streaming, canvas rendering, drawing functions |
| **MediaPipe** | Real-time hand tracking and 3D landmark detection |
| **NumPy** | Array operations for efficient image processing |### ๐จ Drawing System
| Component | Tool/Function |
|------------------|----------------------------|
| Line Drawing | `cv2.line()` |
| Circle Erasing | `cv2.circle()` |
| Canvas Overlay | NumPy + OpenCV masking |
| Color Palette UI | On-screen rectangles |---
## ๐ฅ Installation
```bash
# Clone this repository
git clone https://github.com/yourusername/hand-gesture-drawing.git
cd hand-gesture-drawing# Install required libraries
pip install opencv-python mediapipe numpy# Run the application
python app.py
````---
## ๐ผ๏ธ Screenshots
| Drawing Mode | Eraser Mode | Color Palette |
| ------------------------- | -------------------------- | -------------------------- |
|  |  |  |---
## ๐งฉ How It Works
1. ๐ฅ๏ธ OpenCV captures real-time video from the webcam
2. โ MediaPipe detects 21 hand landmarks
3. ๐ง Gesture logic determines if fingers are up/down
4. ๐จ Drawing or erasing actions are applied on a NumPy-based canvas
5. ๐ The canvas is overlaid on the webcam stream for a real-time visual experience---
## โ๏ธ Customization Options
* ๐ฏ **Add New Colors:** Modify `colors[]` and `color_names[]` lists
* โ๏ธ **Change Brush/Eraser Size:** Update `brush_thickness` and `eraser_thickness`
* ๐ค **Save Canvas:** Use `cv2.imwrite('drawing.png', canvas)`
* ๐ **Add More Gestures:** Expand the `fingers_up()` logic for new controls---
## ๐ Future Improvements
* [ ] Gesture to clear entire canvas
* [ ] Option to save drawings via GUI button or gesture
* [ ] Streamlit/Flask web interface
* [ ] Add more brushes (dotted, calligraphy)---
---
### โ Why This Works Better
* Pure markdown = more reliable across GitHub, GitLab, Bitbucket, etc.
* Respects dark/light modes.
* Easier to edit and maintain.---
## ๐ Author
Made with โค๏ธ by [Chandu](https://github.com/venkat-0706)
๐ Connect on [Linkedin](https://www.linkedin.com/in/chandu-0706)
---
## ๐ License
This project is licensed under the **MIT License**. Feel free to use and modify it as you wish!
---
If you like this project, consider giving it a โญ and sharing it!
```---
### โ Next Steps for You:
* Replace placeholders like `yourusername`, image paths, and LinkedIn links.
* Add a demo GIF in `screenshots/demo.gif`
* Create high-quality screenshots of each mode (drawing, erasing, color switching).