This project, Virtual Painter, allows users to draw and erase in real-time using hand gestures captured through a webcam. The tool leverages MediaPipe for hand gesture detection and OpenCV for drawing and interaction. The user can select colors, switch between drawing and erasing, and even undo or redo actions.
- β Hand Gesture Recognition: Detects hand gestures using MediaPipe, enabling drawing and erasing via simple hand movements.
- π¨ Dynamic Color Selection: Allows users to pick a drawing color using a color picker or predefined color options.
- π Undo/Redo Functionality: Undo and redo actions to easily correct mistakes.
- ποΈ Real-Time Drawing: Draw and erase in real-time using hand gestures.
- π₯οΈ FPS Display: Tracks and displays the frames per second (FPS) for smooth interaction.
- Python: Main programming language.
- MediaPipe: For hand gesture recognition.
- OpenCV: For image processing and drawing tasks.
- Tkinter: For color picker interface.
- Run the script: Execute the Python script to start the webcam and initialize the drawing interface.
- Hand Gestures:
- Drawing: Hold your index finger up to draw.
- Erasing: Use the 'Eraser' tool by selecting it with your hand.
- Undo/Redo: Press 'Z' to undo and 'Y' to redo actions.
- Color Selection:
- Use the predefined color palette at the top to choose from basic colors.
- Use the color picker to select a custom color.
- Clear the Canvas: Click the "Clear" icon to reset the canvas.
- Save Canvas State: Press 'S' to save the current drawing state.
- ποΈ Color Palette: Switch between predefined colors or select custom colors.
- β©οΈ Undo/Redo Stack: Keep track of changes to your drawing with the undo and redo functionality.
- π Color Picker: Opens a Tkinter color chooser to pick any color for drawing.
-
Clone the Repository:
git clone https://github.com/Shubham7-1/Virtual-Painter.git cd virtual-painter -
Install Dependencies: You need OpenCV, MediaPipe, and Tkinter. You can install them using pip:
pip install opencv-python mediapipe
-
Run the Script: Ensure that you have a webcam connected and simply run:
python virtual_painter.py
- ποΈ Multi-Hand Detection: Allow multiple users to draw simultaneously.
- βοΈ Shape Drawing: Add tools to draw shapes like circles, rectangles, and lines.
- πΎ Save Functionality: Save your artwork as an image file.
- ποΈ Custom Brushes: Implement more brush styles and textures.

