Virtual Canvas is an interactive drawing application that allows users to draw using hand gestures. Utilizing MediaPipe for hand tracking, this project enables gesture-based drawing, erasing, and shape selection using a webcam. The application provides an intuitive and touch-free way to create digital sketches.
- Hand Tracking: Uses MediaPipe Hands to detect and track hand movements.
- Gesture-Based Drawing: Supports freehand drawing, shape selection, and erasing.
- Multiple Colors & Shapes: Users can switch between different colors and shapes such as circles, rectangles, and ellipses.
- Dynamic Brush & Eraser Thickness: Adjusts based on finger distance.
- Real-time Processing: Smooth interaction and minimal latency.
- Python
- OpenCV
- MediaPipe
- NumPy
- os (for managing images and assets)
-
Clone the Repository
git clone https://github.com/SagarMaddela/Virtual-Canvas.git cd Virtual-Canvas -
Install Dependencies Ensure you have Python installed (preferably 3.7+), then install the required packages:
pip install opencv-python mediapipe numpy
- Run the Application
python Main.py
- Interact Using Gestures
- Index & Middle Finger Up → Selection Mode (Choose colors/shapes/eraser)
- Only Index Finger Up → Drawing Mode (Draw on the canvas)
- Index & Thumb Close Together → Adjust Brush/Eraser Size
VirtualCanvas/
│-- MY Header/ # Folder containing UI overlay images
│-- Main.py # Main script to run the Virtual Canvas
│-- HandTrackingModule.py # Module for hand tracking functionalities
│-- README.md # Project documentation
-
Camera Not Opening?
- Ensure your webcam is connected and functional.
- Try changing
video = cv2.VideoCapture(1)tocv2.VideoCapture(0).
-
Hand Not Detected?
- Make sure your hand is well-lit and visible to the camera.
- Adjust
detectionConinhandDetector()for better recognition.
Feel free to fork this repository and submit pull requests for improvements.
This project is open-source and available under the Apache License.
Developed by Sagar Maddela
For any queries, feel free to reach out on GitHub.
Happy Drawing! 🎨