This project implements a hand tracking system using OpenCV and MediaPipe to recognize hand gestures. It allows users to draw on a canvas using their index and middle fingers and send the drawn image to an AI model for interpretation.
- Hand Tracking: Uses MediaPipe to detect and track hands in real time.
- Gesture Recognition: Recognizes specific finger gestures to perform actions.
- Drawing Functionality: Allows users to draw by moving their hand.
- AI Interaction: Sends the drawn image to an AI model for interpretation.
- Clear Canvas: Users can reset the drawing canvas using a specific gesture.
Make sure you have the following installed:
- Python 3.x
- OpenCV (
cv2module) - NumPy
- Pillow (
PILmodule for image handling) - Google Generative AI SDK
Run the following command to install the required libraries:
pip install -r requirements.txt- Clone or download the project.
- Open a terminal and navigate to the project directory.
- Set up the API key for Google Generative AI by setting the environment variable
API_KEY. - Run the script:
python main.py
- The webcam feed will appear.
- Use the following hand gestures:
- [0,1,1,0,0]: Draw on the canvas.
- [0,1,0,0,1]: Clear the canvas.
- [1,1,1,0,1]: Send the canvas to AI for interpretation.
- 'q': Quit the application.
air-canvas/
│── .gitignore # Git ignore file
│── IMPORTS.py # Module for imports and configuration
│── main.py # Main script
│── requirements.txt # Dependencies
│── README.md # Documentation
- The script initializes a webcam feed and detects hands using MediaPipe.
- Specific hand gestures control drawing, clearing, and sending to AI.
- The drawn image is processed and sent to the AI model for interpretation.
- Multiple Hand Support: Extend tracking for multiple users.
- Gesture Customization: Allow users to define their own gestures.
- Different Brush Sizes: Add the ability to change the drawing thickness.
- Save Drawings: Option to save drawn images locally.
This project is open-source. Feel free to modify and improve it!
Biswajit Mallik