Skip to content

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

🖱️ Gesture-Controlled Air Mouse

A Python-based virtual mouse that uses hand gestures detected via webcam to control your computer's cursor.

✨ Features

  • ☝ Cursor Movement: Move cursor with index finger
  • 🤏 Left Click: Pinch gesture (thumb + index finger)
  • ✌️ Right Click: Two fingers up (index + middle)
  • 👊 Drag: Closed fist gesture
  • 📜 Scroll: Palm open + move hand up/down
  • 🎚️ Smooth Movement: Interpolated cursor with adjustable sensitivity
  • 📊 Real-time FPS: Visual performance monitoring
  • 🎨 Visual Feedback: Hand landmarks and gesture overlay

🛠️ Installation

Prerequisites

  • Python 3.8 - 3.11 (recommended)
    • ⚠️ Minimum: Python 3.8
    • ✅ Best compatibility: Python 3.9 or 3.10
    • ⚠️ Python 3.12+ may have MediaPipe compatibility issues
  • Webcam (built-in or USB)
  • Operating System: Windows 10/11, Linux, or macOS

Setup

  1. Check your system (recommended):
python check_system.py

This will verify your Python version, dependencies, and camera.

  1. Clone or navigate to the project directory:
cd n:\gesture-controller
  1. Install dependencies:
pip install -r requirements.txt

🚀 Usage

Run the application:

python main.py

Gestures

Gesture Action Description
☝ Index Finger Up Move Cursor Point with index finger to control cursor
🤏 Pinch Left Click Bring thumb and index finger together
✌️ Two Fingers Right Click Extend index and middle fingers
👊 Fist Drag Close all fingers to drag items
✋ Palm Open Scroll Open palm and move hand up/down

Keyboard Controls

Key Action
Q Quit application
S Toggle camera view on/off
+ Increase cursor sensitivity
- Decrease cursor sensitivity

Emergency Stop

Move your mouse to the top-left corner of the screen to trigger PyAutoGUI's failsafe and stop the program.

⚙️ Configuration

You can adjust settings in main.py:

# Hand tracking confidence
detection_confidence=0.7
tracking_confidence=0.7

# Cursor smoothing (0-1, higher = smoother)
smoothing=0.7

# Cursor sensitivity (0.5-3.0)
sensitivity=1.5

# Gesture thresholds
pinch_threshold=40
fist_threshold=50

📁 Project Structure

gesture-controller/
├── main.py                 # Main application
├── hand_tracker.py         # Hand detection using MediaPipe
├── gesture_detector.py     # Gesture recognition logic
├── cursor_controller.py    # Mouse control with PyAutoGUI
├── requirements.txt        # Python dependencies
└── README.md              # This file

🔧 Troubleshooting

Camera not detected

  • Check if your webcam is connected
  • Try changing camera index in main.py: cv2.VideoCapture(1) or cv2.VideoCapture(2)

Low FPS

  • Reduce camera resolution in main.py
  • Lower detection confidence
  • Close other applications

Cursor too sensitive/slow

  • Press + or - to adjust sensitivity in real-time
  • Modify sensitivity parameter in code

Gestures not recognized

  • Ensure good lighting
  • Keep hand within camera frame
  • Adjust pinch_threshold and fist_threshold values

📦 Dependencies

  • opencv-python: Camera capture and image processing
  • mediapipe: Hand landmark detection
  • pyautogui: Mouse control
  • numpy: Mathematical operations

🎯 Performance

  • FPS: 40-80 FPS (depending on CPU)
  • Latency: ~20-50ms
  • Accuracy: 21 hand landmarks tracked

🤝 Contributing

Feel free to fork, modify, and improve this project!

📄 License

MIT License - Feel free to use this project for personal or commercial purposes.

🙏 Credits

  • MediaPipe by Google for hand tracking
  • OpenCV for computer vision
  • PyAutoGUI for mouse control

Enjoy your gesture-controlled mouse! 🎉

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages