AirCanvas is a computer vision project that lets you draw using hand gestures. Built with OpenCV and MediaPipe, it tracks your hand movements to simulate basic painting—like MS Paint, but without a mouse.
AirCanvas transforms your webcam into an interactive digital canvas, allowing you to create art using just your hand gestures in the air. The application uses:
- MediaPipe for real-time hand tracking and gesture recognition
- OpenCV for image processing and drawing operations
- Computer Vision techniques to interpret hand movements as drawing commands
The project demonstrates how computer vision can be used to create natural human-computer interfaces, enabling creative expression without physical input devices.
- Python 3.8 or higher
- Webcam or camera
-
Clone the repository:
git clone https://github.com/d4min/aircanvas.git cd aircanvas
-
Create a virtual environment (recommended):
# Using conda conda create -n aircanvas python=3.8 conda activate aircanvas # Or using venv python -m venv aircanvas source aircanvas/bin/activate # On Windows: aircanvas\Scripts\activate
-
Install the required packages:
pip install -r requirements.txt
-
Run the application:
python src/main.py
AirCanvas recognises different hand gestures to control drawing functions:
Make a pinch gesture with your index finger and thumb to draw. Move your hand while maintaining the pinch to create lines and shapes.
Point with your index finger to select colors from the palette on the right side of the screen.
Show an open palm to erase. A circle will appear around your index finger showing the eraser size.
- Colour Palette: Located on the right side of the screen
- Current Colour: Displayed in the top-left corner
- Exit: Press 'q' to quit the application
AirCanvas includes an audio recognition feature that allows you to control the application using voice commands. This feature leverages the speech_recognition
library to interpret spoken words and execute corresponding actions within the application.
- "Clear": Clears the canvas.
- "Exit": Closes the application.
- "Blue", "Red", "Green", "Yellow", "White": Changes the drawing color to the specified color.
The audio recognition runs in a separate thread, allowing it to listen for commands continuously while you draw.
Special thanks to @AlexCaranha for implementing the speech recognition functionality.
- Project structure setup
- Dependencies installation
- Camera integration
- Basic configuration
- MediaPipe integration
- Landmark detection
- Coordinate system
- Real-time tracking
- Basic gesture detection
- Gesture states
- Action mapping
- Gesture refinement
- Drawing implementation
- Color system
- Audio commands
- Tool panel
- Save/Load system
- Shapes e.g. Rectangle, Circle
- Pen thickness
✅ Complete 🔄 In Progress ⏳ Planned