A touchless computer interaction system built with OpenCV and MediaPipe. Control your mouse and type using just your hands in front of a webcam — no physical contact required.
- Left hand controls the OS mouse cursor. Pinch your thumb and index finger together to left-click.
- Right hand hovers over the virtual QWERTY keyboard rendered on screen. Pinch to press a key.
- Full QWERTY layout with number row
- Caps Lock with visual ON/OFF indicator
- Space, Enter, Backspace, Delete Word, and Clear buttons
- Transparent keyboard overlay — camera feed stays fully visible
- Real-time FPS counter and typed text display
- Smooth mouse movement with EMA filtering
- Python 3.8+
- A webcam
Install dependencies:
pip install -r requirements.txtpython key.pyPress Q to quit.
If your webcam isn't detected, change CAM_INDEX at the top of key.py from 0 to 1 or 2.
All settings are at the top of key.py:
| Variable | Default | Description |
|---|---|---|
CAM_INDEX |
0 |
Webcam index |
CAM_W / CAM_H |
1280 × 720 |
Camera capture resolution |
SCREEN_W / SCREEN_H |
1280 × 832 |
Your monitor resolution |
SMOOTHING |
5 |
Mouse smoothing (higher = smoother) |
PINCH_DIST |
40 |
Pixel distance to register a pinch |
- OpenCV — camera capture and frame rendering
- MediaPipe — real-time hand landmark detection
- pynput — keyboard and mouse control
- NumPy — image blending and coordinate mapping
| Action | Gesture |
|---|---|
| Move mouse | Left hand index finger tip |
| Left click | Left hand pinch |
| Hover key | Right hand index finger tip over key |
| Press key | Right hand pinch while hovering |
| Caps Lock | Pinch the CAPS key |
| Delete word | Pinch ⌫WRD |
| Clear all | Pinch CLR |