https://github.com/sayyedrabeeh/virtual-painter
A virtual painting app built with Python that lets you draw using hand gestures or mouse input. Powered by OpenCV & MediaPipe for real-time gesture tracking. Ideal for AI, CV, and creative tech enthusiasts!
https://github.com/sayyedrabeeh/virtual-painter
ai-project computer-vision drawing-app gesture-control hand-tracking mediapipe opencv python virtual-painting
Last synced: about 1 year ago
JSON representation
A virtual painting app built with Python that lets you draw using hand gestures or mouse input. Powered by OpenCV & MediaPipe for real-time gesture tracking. Ideal for AI, CV, and creative tech enthusiasts!
- Host: GitHub
- URL: https://github.com/sayyedrabeeh/virtual-painter
- Owner: sayyedrabeeh
- License: mit
- Created: 2025-04-26T07:03:04.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-10T12:45:22.000Z (about 1 year ago)
- Last Synced: 2025-05-10T13:27:55.545Z (about 1 year ago)
- Topics: ai-project, computer-vision, drawing-app, gesture-control, hand-tracking, mediapipe, opencv, python, virtual-painting
- Language: Python
- Homepage:
- Size: 4.11 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# ๐จ Virtual Painter
This project is a A professional-grade virtual painting application that transforms your webcam into an interactive canvas, enabling you to create digital art using hand gestures or mouse controls.. If you find this repository helpful or interesting, please consider giving it a star! โญ and Follow Me for cool Projects
## Why Star This Repository?
- It helps others discover the project.
- It motivates the me to keep improving it.
- It supports open-source development!
## How to Contribute
If you want to contribute, feel free to fork the repository and submit a pull request. Also, donโt forget to star the repo!
Thanks for your support! โค
[Star the project](https://github.com/sayyedrabeeh/virtual-painter)
### ๐ผ๏ธ Click any image below to watch the demo video:
### ๐ผ๏ธ Click image below :
## โจ Features
- **Intuitive Controls** - Paint using either hand gestures (via webcam) or traditional mouse input
- **Multiple Tools** - Express your creativity with various drawing tools:
- Brush
- Eraser
- Rectangle (outline and filled)
- Circle (outline and filled)
- Line tool
- **Color Palette** - Choose from 12 vibrant colors
- **Adjustable Brush Sizes** - Customize your brush thickness for precise control
- **Gesture Recognition** - Uses MediaPipe hand tracking for pinch-to-draw functionality
- **Canvas Manipulation** - Clear canvas option to start fresh
- **Smooth Drawing** - Point averaging for smoother lines and reduced jitter
- **Professional UI** - Clean, intuitive interface with visual feedback
## ๐ฅ๏ธ Requirements
- Python 3.6+
- OpenCV (`cv2`)
- NumPy
- MediaPipe
- Webcam (for hand gesture functionality)
## ๐ Installation
1. Clone this repository:
```bash
git clone https://github.com/sayyedrabeeh/virtual-painter.git
cd virtual-painter
```
2. Install the required packages:
```bash
pip install opencv-python numpy mediapipe
```
3. Run the application:
```bash
python virtual_painter.py
```
## ๐ฎ How to Use
### Mouse Controls
- **Select Colors/Tools**: Click on the buttons at the top of the screen
- **Draw**: Click and drag on the canvas area
- **Create Shapes**: Click to set the starting point, drag to adjust size/position, and release to place the shape
### Hand Gesture Controls
- **UI Interaction**: Move your index finger to the top of the screen to select tools and colors
- **Drawing**:
- Make a pinching gesture with your index and middle fingers to start drawing
- Release the pinch to stop drawing
- For shapes, pinch at the starting point, move to adjust size, and release to place
### Buttons and Functions
- **Color Selection**: Choose from 12 vibrant colors (top left)
- **Tool Selection**: Select your desired drawing tool (middle top)
- **Brush Size Control**: Adjust the thickness of your brush using + and - buttons (top right)
- **Clear Canvas**: Reset your entire canvas to start over
## ๐ง Technical Details
The application uses:
- **OpenCV** for image processing and UI rendering
- **MediaPipe** for hand landmark detection and tracking
- **NumPy** for efficient array operations
- **Collections.deque** for smooth point tracking and interpolation
Hand detection tracks your index finger for pointing and detects "pinch" gestures (index finger and middle finger proximity) for drawing actions.
## ๐ ๏ธ Customization
You can easily customize the application by modifying these parameters in the code:
- Add more colors to the `colors` list
- Adjust brush sizes in the `brush_size` list
- Add new tools to the `tools` list (requires implementing corresponding drawing functions)
- Change UI dimensions in the initialization section
## ๐ซ Support This Project
If you find Virtual Painter fun, helpful, or inspiring, please consider giving it a โญ๏ธ on GitHub โ it helps boost visibility, supports the project, and motivates further development!
Your star is like a digital high-five ๐ โ and it truly means a lot!
๐ Click the star at the top-right corner of this page to support!
Want to see more gesture-controlled creativity tools?
A star helps us bring more magic to your screen. โจ๐จ

## ๐ Acknowledgements
- [OpenCV](https://opencv.org/) - The backbone of our computer vision functionality
- [MediaPipe](https://mediapipe.dev/) - For the amazing hand tracking capabilities
- [NumPy](https://numpy.org/) - For efficient numerical operations
---
Developed with โค๏ธ for Art Enthusiasts
Happy Coding ๐จ