This repository contains two powerful computer vision-based gesture control applications:
- AI Virtual Keyboard - Type without touching your physical keyboard
- Advanced Virtual Mouse - Control your cursor with hand gestures
Both applications use webcam input to track hand movements and translate them into keyboard or mouse actions, providing a touchless interface for computer interaction.
- Virtual on-screen keyboard with visual feedback
- Type by making "clicking" gestures with your hand
- Text editing capabilities and cursor control
- Word suggestions and autocorrection
- Special keys (Space, Backspace, Shift, Enter, etc.)
- Page navigation controls
- Zoom functionality
- Audio feedback for keypresses
- Control cursor movement with hand gestures
- Perform left and right clicks
- Drag and drop functionality
- Scrolling (single and continuous modes)
- Zoom control
- Multiple gesture modes with visual indicators
opencv-python
numpy
mediapipe
autopy
pyautogui
pygame
- Clone this repository:
git clone https://github.com/yourusername/hand-gesture-control.git
cd hand-gesture-control- Install dependencies:
pip install opencv-python numpy mediapipe autopy pyautogui pygamepython virtual_keyboard.pypython virtual_mouse.py- Move your hand to position the cursor
- Bring your index and middle fingers together to "click" keys
- Distance between fingers must be less than 40 pixels to register a click
- Two fingers up (index and middle): Move cursor
- Middle finger down, index up: Right-click
- Index finger down, middle up: Left-click
- Closed fist: Start drag operation (hold and move)
- Opening hand after drag: End drag operation
- Three fingers up: Single scroll mode (move hand up/down to scroll)
- Four fingers up: Continuous scroll mode with variable speed
- Five fingers up: Zoom mode (move hand up to zoom in, down to zoom out)
Both applications use MediaPipe's hand tracking solution to detect hand landmarks in real-time. The systems process these landmarks to determine finger positions and gestures, which are then mapped to keyboard or mouse actions.
Key components include:
- Hand detection and tracking
- Gesture recognition algorithms
- Coordinate mapping and transformation
- User interface elements
- Performance optimization for real-time operation
You can modify these parameters in the code to customize your experience:
- Keyboard layout and key size
- Click detection threshold
- Sound effects
- Word suggestion dictionary
- Auto-correction pairs
- Gesture cooldown times
- Scroll speed
- Movement smoothening factor
- Click detection sensitivity
- Poor detection: Ensure you have good lighting conditions
- Cursor jitter: Increase the smoothening factor
- Accidental clicks: Adjust the click detection threshold
- Performance issues: Reduce camera resolution or close background applications
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- MediaPipe team for their excellent hand tracking solution
- OpenCV community for computer vision tools
- PyAutoGUI developers for system control capabilities