Skip to content

Latest commit

ย 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ–๏ธ Gesture Based Controller

Control Your Computer Using Hand Gestures

A real-time hand gesture recognition system built with Python, MediaPipe, OpenCV, and PyAutoGUI that transforms your webcam into a virtual mouse, presentation remote, and game controller.

Python OpenCV MediaPipe License


๐Ÿ“– Overview

Gesture Based Controller is a computer vision project that allows users to control their computer without touching a mouse or keyboard.

Using a webcam, the system detects hand landmarks in real time and converts predefined gestures into mouse movements and keyboard shortcuts.

The project supports three operating modes:

  • ๐Ÿ–ฅ Desktop Control
  • ๐ŸŽค Presentation Control
  • ๐ŸŽฎ Game Control

โœจ Features

๐Ÿ–ฅ Desktop Mode

  • ๐Ÿ–ฑ Cursor Movement
  • ๐Ÿ‘† Left Click
  • ๐Ÿ‘†๐Ÿ‘† Right Click (Double Pinch)
  • ๐Ÿ“œ Scroll Up
  • ๐Ÿ“œ Scroll Down
  • ๐Ÿ”„ Alt + Tab Application Switcher
  • ๐Ÿ“‘ Ctrl + Tab Browser Switching
  • โŒจ Press Enter

๐ŸŽค Presentation Mode

Control presentations without touching the keyboard.

  • ๐Ÿ‘‰ Swipe Right โ†’ Next Slide
  • ๐Ÿ‘ˆ Swipe Left โ†’ Previous Slide
  • โœ‹ Open Palm โ†’ Start Slideshow (F5)
  • โœŠ Closed Fist โ†’ Exit Slideshow (Esc)

๐ŸŽฎ Game Mode

Play arrow-key based games using gestures.

Gesture Keyboard Action
โ˜ Index Finger Right Arrow
โœŒ Peace Sign Left Arrow
๐Ÿ– Open Palm Up Arrow (Jump)
โœŠ Closed Fist Down Arrow (Duck)

Works great with games like:

  • Subway Surfers
  • Temple Run
  • Chrome Dino
  • Any Arrow-Key Based Game

๐Ÿ”„ Mode Switching

Raise only your Pinky Finger for 1 second to switch between modes.

Desktop
   โ†“
Presentation
   โ†“
Game
   โ†“
Desktop

๐Ÿง  Technologies Used

  • Python
  • OpenCV
  • MediaPipe Tasks API
  • PyAutoGUI
  • NumPy

๐Ÿ“ฆ Installation

1. Clone the Repository

git clone https://github.com/manisbhusal/Gesture-Based-Controller.git
cd Gesture-Based-Controller

2. Create Virtual Environment (Recommended)

Windows

python -m venv .venv
.venv\Scripts\activate

Linux / macOS

python3 -m venv .venv
source .venv/bin/activate

3. Install Dependencies

python -m pip install opencv-python
pip install opencv-python mediapipe pyautogui numpy

`` If pip isn't found

Install it first:

sudo apt update
sudo apt install python3-pip

---

## 4. Run the Project

```bash
python gesture.py

`` If you're using a virtual environment (recommended)

Create one:

python3 -m venv .venv

Activate it:

source .venv/bin/activate

Then install everything:

pip install opencv-python mediapipe pyautogui numpy

Run your program:

python gesture.py

The MediaPipe hand tracking model will automatically download during the first execution.

Press Q to quit.


๐ŸŽฎ Gesture Reference

Desktop Mode

Gesture Action
โ˜ Index Finger Move Cursor
๐Ÿค Pinch Left Click
๐Ÿค๐Ÿค Double Pinch Right Click
โœŒ Index + Middle Scroll Up
โœŠ Closed Fist Scroll Down
๐Ÿ– Four Fingers Alt + Tab
๐ŸคŸ Middle + Ring + Pinky Ctrl + Tab
๐ŸคŸ Index + Middle + Ring Enter

Presentation Mode

Gesture Action
๐Ÿ‘‰ Swipe Right Next Slide
๐Ÿ‘ˆ Swipe Left Previous Slide
๐Ÿ– Open Palm Start Presentation
โœŠ Closed Fist Exit Presentation

Game Mode

Gesture Keyboard
โ˜ Index Right Arrow
โœŒ Peace Left Arrow
๐Ÿ– Open Palm Up Arrow
โœŠ Closed Fist Down Arrow

โš™๏ธ Smart Features

  • โœ… Cursor Smoothing
  • โœ… Dynamic Hand Scaling
  • โœ… False Gesture Protection
  • โœ… Gesture Cooldowns
  • โœ… Double Pinch Detection
  • โœ… Swipe Detection
  • โœ… Gesture Latching
  • โœ… Automatic MediaPipe Model Download

๐Ÿ“ Project Structure

Gesture-Based-Controller/
โ”‚
โ”œโ”€โ”€ gesture.py
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ requirements.txt
โ””โ”€โ”€ hand_landmarker.task

๐Ÿ’ป Requirements

  • Python 3.10+
  • Webcam
  • Windows, Linux or macOS

Note: Windows provides the best compatibility with PyAutoGUI. On Linux, using X11 is recommended instead of Wayland.


โš ๏ธ Tips for Best Performance

  • Use a well-lit environment.
  • Keep only one hand visible.
  • Position your webcam directly in front of you.
  • Avoid cluttered backgrounds.
  • Maintain a consistent distance from the camera.

๐Ÿš€ Future Roadmap

  • Multi-Hand Support
  • Volume Controller
  • Brightness Controller
  • Media Controls
  • Drag & Drop
  • Virtual Keyboard
  • Custom Gesture Training
  • AI Gesture Recognition
  • Voice + Gesture Hybrid Control
  • Settings GUI
  • User Profiles

๐Ÿค Contributing

Contributions are welcome!

  1. Fork this repository

  2. Create a new branch

git checkout -b feature-name
  1. Commit your changes
git commit -m "Add new feature"
  1. Push your branch
git push origin feature-name
  1. Open a Pull Request.

๐Ÿž Known Limitations

  • Requires adequate lighting.
  • Supports only one hand.
  • Extremely fast hand movements may not be detected.
  • Webcam quality directly affects tracking accuracy.
  • Some keyboard shortcuts may differ between operating systems.
  • PyAutoGUI has limited support on Wayland (Linux).

๐Ÿ“„ License

This project is licensed under the MIT License.

Feel free to use, modify, and distribute it.


๐Ÿ™ Acknowledgements

Special thanks to:

  • MediaPipe
  • OpenCV
  • PyAutoGUI
  • NumPy
  • Python Community

โญ If you like this project

Give it a โญ on GitHub and consider sharing it with others.

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages