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
- It helps others discover the project.
- It motivates the me to keep improving it.
- It supports open-source development!
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! ❤


- 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
- Python 3.6+
- OpenCV (
cv2
) - NumPy
- MediaPipe
- Webcam (for hand gesture functionality)
-
Clone this repository:
git clone https://github.com/sayyedrabeeh/virtual-painter.git cd virtual-painter
-
Install the required packages:
pip install opencv-python numpy mediapipe
-
Run the application:
python virtual_painter.py
- 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
- 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
- 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
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.
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
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. ✨🎨
- OpenCV - The backbone of our computer vision functionality
- MediaPipe - For the amazing hand tracking capabilities
- NumPy - For efficient numerical operations
Developed with ❤️ for Art Enthusiasts