This project implements a virtual keyboard using hand tracking. By hovering your fingertip over predefined virtual keys, the corresponding letters are typed in Notepad. The project uses computer vision and hand tracking for interaction without physical contact.
- Tracks the fingertip using a webcam and MediaPipe.
- Detects hovering over virtual keys (
QandW) and types them in Notepad. - Visual feedback when hovering over or selecting keys.
- Interactive UI displayed via OpenCV.
The following libraries are required:
- opencv-python: For capturing video and displaying the interactive UI.
- mediapipe: For hand landmark detection and tracking.
- pyautogui: For simulating key presses.
- subprocess: For launching Notepad.
- Initialization:
- Launches Notepad on startup using the
subprocesslibrary. - Initializes the webcam for capturing real-time video.
- Launches Notepad on startup using the
- Hand Tracking:
- Uses MediaPipe to detect and track the user's hand.
- Tracks the index fingertip position for interaction.
- Virtual Keyboard:
- Displays buttons for
QandWon the screen. - Changes button color when the fingertip hovers over a button.
- Types the corresponding key in Notepad if the hover time exceeds a threshold.
- Displays buttons for
- Clone this repository:
git clone https://github.com/rishraks/Virtual_Keyboard.git
- Install the required libraries:
pip install opencv-python mediapipe pyautogui
- Run the script:
python Virtual_Keyboard.py
- Allow access to your webcam.
- Hover your fingertip over the virtual keys (Q or W or anykey) to type them in Notepad.
- Modify the buttons array in the script to add more keys or change button positions.
- Adjust the threshold_time variable to change the hover duration required for a keypress.
- Python 3.7 or higher
- Webcam for hand tracking
- Windows OS (for Notepad integration)
This project is licensed under the MIT License. See the LICENSE file for details.
- MediaPipe for their hand tracking API.
- OpenCV for providing real-time video processing tools.
- PyAutoGUI for simulating keyboard inputs.