Skip to content

Playable League of Legends with Hand Gesture Recognition (OpenCV, Mediapipe, Python)

Notifications You must be signed in to change notification settings

jayjay19630/lazy-league

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Lazy League

Minimal prototype using MediaPipe Hands + OpenCV to recognize simple hand gestures and map them to keyboard/mouse controls for people who want to play League of Legends.

Hand Gesture Controls

This project enables real-time hand gesture control for keyboard and mouse actions using MediaPipe Hands and pynput. The system supports two-hand interactions with distinct roles for the left and right hands.

Left Hand – Keyboard Actions

The left hand controls keyboard shortcuts. Single-finger gestures map to specific keys:

Gesture (Finger) Action (Key Press) Notes
Index Q Tap when thumb is extended, only one finger extended at a time
Middle W Tap when index finger is extended
Ring E Tap when middle finger is extended
Pinky R Tap when ring finger is extended
Other / Fist / Multiple fingers None Ignored to prevent accidental triggers
  • The left hand uses a cooldown (0.25s) between actions to avoid multiple rapid key presses.
  • Only one finger extended at a time triggers an action; ambiguous gestures are ignored.

Right Hand – Mouse Control

The right hand controls the mouse pointer and clicks:

Gesture / Movement Action Notes
Index finger movement Moves the cursor Tracks the index fingertip position frame-to-frame for smooth movement. Adjustable gain and smoothing parameters.
Pinch (Index + Thumb) Left click Detects pinch distance below threshold (0.05 normalized units).
Pinch (Middle + Thumb) Right click Detects pinch distance below threshold.
  • Right-hand gestures operate continuously without toggling.
  • Mouse movement is smoothed using an exponential filter to reduce jitter.

General Notes

  • Controls are always enabled while main.py runs.
  • Uses normalized MediaPipe coordinates, automatically mapped to screen cursor positions.
  • Both hands can operate simultaneously for keyboard and mouse control.
  • Visualization HUD shows gesture detection and current status for feedback.

Requirements

  • Python 3.10 or 3.11 recommended

Setup

python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt

Run

python src/main.py

About

Playable League of Legends with Hand Gesture Recognition (OpenCV, Mediapipe, Python)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages