A computer vision-powered virtual keyboard that lets you type using only hand gestures! No physical keyboard required – just point and "click" with your fingers in the air.
- Gesture-Based Typing: Type by pointing your index finger at virtual keys
- Air Clicking: "Click" keys by bringing your index and middle fingers together
- Real-Time Hand Tracking: Uses MediaPipe for accurate hand detection
- Smart Repeat System: Hold gestures to repeat characters (perfect for deleting multiple characters)
- Audio Feedback: Satisfying click sounds for better user experience
- Full QWERTY Layout: Complete keyboard with Space, Delete, and Clear functions
- Point: Aim your index finger at any key on the virtual keyboard
- Click: Bring your index and middle fingers close together to "press" the key
- Type: Watch your text appear in the text box above the keyboard
- Delete/Clear: Use special function keys for editing
- Python 3.7 or higher
- Webcam/Camera
- Audio output (for click sounds)
-
Clone the repository:
git clone https://github.com/ranaehelal/AI_Virtual_Keyboard.git cd AI_Virtual_Keyboard
-
Install dependencies:
pip install -r requirements.txt
-
Add a sound file:
- Place a
key_click.mp3
file in the project directory - Or modify the sound file path in
button.py
- Place a
-
Run the application:
python main.py
-
Position yourself in front of your camera (about arm's length away)
-
Raise your hand and start typing:
- Point your index finger at keys to hover
- Bring index and middle fingers together to click
- Use the spacebar, delete, and clear buttons as needed
-
Press 'q' to quit the application
Al-Virtual-Keyboard/
├── __pycache__/
├── assets/
├── key_click.mp3
├── modules/
│ ├── __pycache__/
│ ├── __init__.py
│ ├── button.py
│ ├── camera.py
│ └── utils.py
├── main.py
├── docs/
│ └── AL_Virtual_Keyboard_Guide.pdf
├── README.md
└── requirements.txt
Modify camera resolution in utils.py
:
FRAME_WIDTH = 1280
FRAME_HEIGHT = 720
Customize the keyboard layout in utils.py
by modifying the keys
array.
Adjust click sensitivity by changing the click_threshold
in utils.py
:
click_threshold = 30 # Lower = more sensitive
- Hand Detection: MediaPipe Hands for real-time hand landmark detection
- Gesture Recognition: Distance calculation between fingertips for click detection
- UI Rendering: OpenCV for real-time graphics and button rendering
- Audio System: Pygame for click sound effects
- Smart Timing: Prevents accidental multiple clicks and enables key repeat functionality
- Camera not working: Check if another application is using the camera
- Hand not detected: Ensure good lighting and clear background
- No sound: Check audio drivers and ensure
key_click.mp3
exists - Slow performance: Try reducing camera resolution or closing other applications
- Use good lighting for better hand detection
- Keep your hand steady for more accurate pointing
- Maintain a consistent distance from the camera
- Ensure your hand is visible against the background
- Fork the repository
- Create a 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
- Add support for special characters and numbers
- Implement word prediction/autocomplete
- Add gesture customization options
- Multi-language keyboard layouts
- Hand gesture shortcuts (copy, paste, etc.)
- Mobile app version
Made with ❤️ and lots of hand gestures!