Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

✋ Virtual Keyboard & Air Mouse

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.


How It Works

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

Features

  • 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

Requirements

  • Python 3.8+
  • A webcam

Install dependencies:

pip install -r requirements.txt

Usage

python key.py

Press Q to quit.

If your webcam isn't detected, change CAM_INDEX at the top of key.py from 0 to 1 or 2.


Configuration

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

Tech Stack

  • OpenCV — camera capture and frame rendering
  • MediaPipe — real-time hand landmark detection
  • pynput — keyboard and mouse control
  • NumPy — image blending and coordinate mapping

Demo Controls

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

About

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.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages