AirDraw is a real-time computer vision application developed using Python, OpenCV, and NumPy. The system uses a webcam to detect and track a green-colored object, allowing users to draw on a virtual canvas without using a mouse or touchscreen.
The project demonstrates how computer vision techniques such as color segmentation, contour detection, object tracking, and real-time image processing can be used to create an interactive drawing application.
- Real-time webcam video processing
- Green object detection and tracking
- Virtual drawing canvas
- Multiple drawing colors
- Eraser mode
- Pause and draw mode
- Canvas clearing function
- User-friendly keyboard controls
- No external datasets or image files required
| Technology | Purpose |
|---|---|
| Python | Main programming language |
| OpenCV | Video capture and image processing |
| NumPy | Array and image manipulation |
- Capture live video from the webcam using OpenCV.
- Convert each frame from BGR color space to HSV color space.
- Detect the green object using color thresholding.
- Find the largest contour corresponding to the tracked object.
- Calculate the center position of the object.
- Use the center position as a virtual pen.
- Draw lines on a digital canvas based on object movement.
- Display the updated drawing in real time.
Webcam
↓
OpenCV Video Capture
↓
HSV Color Conversion
↓
Green Object Detection
↓
Contour Detection
↓
Center Point Tracking
↓
Drawing Logic
↓
Virtual Canvas Output
The system tracks a green-colored object using the HSV color space.
The processing steps are:
- Convert the webcam frame to HSV format.
- Apply color thresholding to isolate green pixels.
- Remove noise using erosion and dilation.
- Detect contours in the thresholded image.
- Track the center of the largest detected contour.
The tracked center point is used as a virtual pen for drawing.
| Key | Function |
|---|---|
| D | Enable Drawing |
| P | Pause Drawing |
| B | Blue Drawing Color |
| G | Green Drawing Color |
| R | Red Drawing Color |
| E | Eraser Mode |
| C | Clear Canvas |
| Q | Quit Application |
git clone https://github.com/yourusername/AirDraw.git
cd AirDrawpip install opencv-python numpypython3 airdraw.pyAirDraw/
│
├── airdraw.py
├── README.md
└── screenshots/
- Start the application.
- Hold a green object in front of the webcam.
- Move the object to draw on the canvas.
- Change drawing colors using keyboard shortcuts.
- Use pause mode when repositioning the object.
- Use eraser mode when needed.
- Clear the canvas or exit the application.
![]() |
![]() |
This project applies several important computer vision techniques:
- Real-Time Video Processing
- HSV Color Space Conversion
- Color Segmentation
- Contour Detection
- Object Tracking
- Image Drawing and Overlay
- Human-Computer Interaction
During development, several challenges were encountered:
- Maintaining stable color detection under different lighting conditions
- Reducing drawing jitter caused by rapid object movement
- Improving object tracking accuracy
- Implementing pause and drawing modes for better usability
Future versions of AirDraw can be updated:
- Multi-color object tracking
- Shape recognition
- Save drawing as image
- Gesture-based controls
- Virtual whiteboard collaboration
- AI-powered handwriting recognition
The goal of this project is to explore computer vision techniques and develop an interactive drawing application using object tracking technology. AirDraw demonstrates how webcam-based systems can be used to create intuitive and engaging human-computer interaction.
Seng Cyn Mai

