Skip to content

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.

Notifications You must be signed in to change notification settings

Mariam-Badr-MB/AI_Virtual_Keyboard

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🖐️ Virtual Hand Keyboard

Overview

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.

✨ Features

  • 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

🎥 How It Works

  1. Point: Aim your index finger at any key on the virtual keyboard
  2. Click: Bring your index and middle fingers close together to "press" the key
  3. Type: Watch your text appear in the text box above the keyboard
  4. Delete/Clear: Use special function keys for editing

🛠️ Installation

Prerequisites

  • Python 3.7 or higher
  • Webcam/Camera
  • Audio output (for click sounds)

Setup

  1. Clone the repository:

    git clone https://github.com/ranaehelal/AI_Virtual_Keyboard.git
    cd AI_Virtual_Keyboard
  2. Install dependencies:

    pip install -r requirements.txt
  3. Add a sound file:

    • Place a key_click.mp3 file in the project directory
    • Or modify the sound file path in button.py

🚀 Usage

  1. Run the application:

    python main.py
  2. Position yourself in front of your camera (about arm's length away)

  3. 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
  4. Press 'q' to quit the application

📁 Project Structure

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

🔧 Configuration

Camera Settings

Modify camera resolution in utils.py:

FRAME_WIDTH = 1280
FRAME_HEIGHT = 720

Keyboard Layout

Customize the keyboard layout in utils.py by modifying the keys array.

Sensitivity Settings

Adjust click sensitivity by changing the click_threshold in utils.py:

click_threshold = 30  # Lower = more sensitive

🎯 Technical Details

  • 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

🐛 Troubleshooting

Common Issues

  • 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

Performance Tips

  • 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

🤝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📝 Future Enhancements

  • 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!

About

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.

Topics

Resources

Stars

Watchers

Forks

Languages

  • Python 100.0%