Skip to content

A Python-based virtual painting app that uses your hand gestures (tracked by MediaPipe) as a brush, powered by OpenCV for real-time webcam drawing. You can select colors, switch brush types, erase, and even clear the canvas all using just your fingers!

Notifications You must be signed in to change notification settings

evitabarboza/Virtual-Painter-Using-Hand-Tracking

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 

Repository files navigation

Virtual Painter Using Hand TrackingπŸŽ¨βœ‹

A Python-based virtual painting app that uses your hand gestures (tracked by MediaPipe) as a brush, powered by OpenCV for real-time webcam drawing. You can select colors, switch brush types, erase, and even clear the canvas β€” all using just your fingers!

✨ Features

  • Hand Tracking using MediaPipe

  • Color Selection via gesture-based palette

  • Three Brush Types:

    • Normal
    • Spray
    • Calligraphy
  • Eraser Tool

  • Clear Canvas Gesture

  • Brush Toggle Gesture

  • Real-time Drawing with Webcam

  • Save Drawing with a keypress

πŸ› οΈ Technologies Used

  • Python 3
  • OpenCV
  • MediaPipe
  • NumPy

πŸ“¦ Installation

  1. Clone this repository
git clone https://github.com/evitabarboza/Virtual-Painter-Using-Hand-Tracking
.git
cd Virtual-Painter-Using-Hand-Tracking
  1. Create virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies
pip install opencv-python mediapipe numpy

▢️ Running the App

python app.py
  • A webcam window will open.
  • Use hand gestures to draw and control the interface (explained below).

βœ‹ Gesture Controls

Gesture Action
Index finger + Middle up Select color from top palette
Only Index finger up Draw on the canvas
All 5 fingers up Clear the entire canvas
Index + Middle + Ring fingers up Toggle brush type (Normal β†’ Spray β†’ Calligraphy)
Thumb up Not used

🎨 Tools & UI Elements

  • Top Palette: Select from 8 predefined colors (last is Eraser).

  • Brush Types:

    • Normal: Basic line
    • Spray: Simulated spray effect using random noise
    • Calligraphy: Elliptical strokes like a flat nib pen
  • Brush Size: Fixed size (can be modified in code)

  • Eraser: Last palette color (black), larger thickness

  • Save Drawing: Press s key to save your artwork

  • Quit Application: Press q

πŸ–ΌοΈ Output

Your saved drawing will be stored as:

my_virtual_painting.png

πŸ“ File Structure

Virtual-Painter-Using-Hand-Tracking/
β”‚
β”œβ”€β”€ app.py       # Main Python script
β”œβ”€β”€ README.md    # This file

πŸ”§ Customization Tips

  • Change brush thickness: modify brush_thickness and eraser_thickness.
  • Add more brush styles or gestures.
  • Use dynamic thickness via finger distance.
  • Extend for multiple hand support.

πŸ“œ License

This project is open source under the MIT License.

🀝 Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you'd like to change.

πŸ™‹β€β™€οΈ Author

Evita Barboza

Feel free to reach out at [email protected].

About

A Python-based virtual painting app that uses your hand gestures (tracked by MediaPipe) as a brush, powered by OpenCV for real-time webcam drawing. You can select colors, switch brush types, erase, and even clear the canvas all using just your fingers!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages