Control your computer with hand gestures using computer vision and machine learning.
- Hand Tracking - Real-time 21-point hand landmark detection using MediaPipe
- Gesture Recognition - Detect pinch, fist, pointing, open palm, peace sign, thumbs up
- Cursor Control - Move mouse, click, drag, and scroll with hand gestures
- Air Drawing - Draw in the air with your finger and save your artwork
- Voice Commands - Optional voice control for hands-free actions
- Kalman Filtering - Smooth, jitter-free cursor movement
| Gesture | Action (Cursor Mode) | Action (Draw Mode) |
|---|---|---|
| Point (Index finger) | Move cursor | Draw line |
| Pinch (Thumb + Index) | Click | Select color |
| Fist | Drag | Stop drawing |
| Open Palm | Release | Stop drawing |
| Peace Sign | Double click | - |
- Python 3.8 or higher
- Webcam
- Windows, macOS, or Linux
```bash git clone https://github.com/rachts/Air-mouse.git cd gesture-ar-system ```
```bash python -m venv venv
venv\Scripts\activate
source venv/bin/activate ```
```bash pip install -r scripts/requirements.txt ```
Voice commands require PyAudio which needs additional setup:
Windows: ```bash pip install pyaudio ```
macOS: ```bash brew install portaudio pip install pyaudio ```
Linux (Ubuntu/Debian): ```bash sudo apt-get install python3-pyaudio portaudio19-dev pip install pyaudio ```
```bash cd scripts python main.py ```
```bash python main.py --camera 0 # Use camera index 0 (default) python main.py --camera 1 # Use external camera python main.py --no-cursor # Disable cursor control python main.py --no-draw # Disable drawing mode python main.py --voice # Enable voice commands python main.py --no-mirror # Disable mirror mode ```
| Key | Action |
|---|---|
Q / ESC |
Quit |
M |
Toggle mode (cursor/draw) |
L |
Toggle landmark display |
C |
Clear drawing |
S |
Save drawing to file |
When enabled with --voice:
- Actions: "click", "double click", "drag", "drop"
- Drawing: "clear", "undo"
- Colors: "red", "blue", "green", "yellow", "purple", "white"
- Modes: "cursor", "draw"
``` gesture-ar-system/ ├── scripts/ │ ├── main.py # Main application │ ├── hand_tracker.py # MediaPipe hand tracking │ ├── gestures.py # Gesture recognition │ ├── cursor_controller.py # Mouse control │ ├── kalman_filter.py # Smoothing filter │ ├── air_draw.py # Air drawing │ ├── voice_commands.py # Voice recognition │ └── requirements.txt # Dependencies └── README.md ```
```bash python main.py --camera 1 python main.py --camera 2 ```
```bash pip uninstall mediapipe pip install mediapipe ```
Go to System Preferences > Security & Privacy > Privacy > Accessibility and add Terminal or your Python IDE.
- Windows:
pip install pipwin && pipwin install pyaudio - macOS: Install portaudio first with
brew install portaudio - Linux: Install
portaudio19-devbefore pip install
- Use good, even lighting on your hands
- Plain backgrounds work better than cluttered ones
- Keep your hand 1-3 feet from the camera
- Move your hand slowly for better tracking
- Make clear, distinct gestures
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.