Control the desktop pointer with a webcam and hand gestures. The local camera window shows the live image, detected hand landmarks, the tracking area, and whether desktop control is enabled. OpenCV captures and displays frames, MediaPipe detects hand landmarks, and PyAutoGUI sends pointer, click, and scroll actions to the operating system. A physical webcam and local desktop session are required; this project is not a browser app.
The preview starts with desktop control off. Hand tracking remains visible while control is paused.
flowchart LR
A[Webcam frame] --> B[OpenCV color conversion]
B --> C[MediaPipe hand landmarks]
C --> D[Gesture and coordinate mapping]
D --> E[PyAutoGUI desktop actions]
C --> F[Camera preview and status]
- Python 3.9 or newer and a desktop session with a webcam.
- macOS, Windows, or Linux with GUI access. On macOS, grant camera access and Accessibility permission to the terminal or IDE used to run the program.
- Dependencies listed in
requirements.txt. The app uses MediaPipe Tasks (MediaPipe 0.10.31 or newer) and a small official hand-landmarker model downloaded separately.
git clone https://github.com/ayushcodes13/gesture-controlled-virtual-mouse.git
cd gesture-controlled-virtual-mouse
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
python -m pip install -r requirements.txt
python scripts/download_hand_model.py
python main.pyThe preview opens with desktop control disabled. Focus the preview window and press t to enable pointer movement and gestures. Keep the hand visible in the blue rectangle. Press t again to pause desktop control, or q to close the program. If the camera cannot be opened, check OS camera permission and that another app is not using it.
The model download script verifies the official model's SHA-256 before saving it under models/; the model file is intentionally excluded from Git.
The product UI is the local OpenCV camera window; there is no browser control panel. The screenshot below shows the static project presentation captured in Aside Browser from the local site/ build. It is documentation UI, not the running gesture-control application.
A screenshot of the actual camera window requires the application to run on a machine with the dependencies installed, an accessible webcam, and a graphical desktop. That device-dependent runtime was unavailable in the documentation environment, so no camera or pointer-control behavior is represented as visually verified. The workflow diagram above describes the implemented data flow, not a captured runtime.
The repository includes check_installation.py for checking imports, camera access, Python version, and screen dimensions:
python check_installation.pyCamera and desktop-control behavior require a physical camera, an interactive display, and OS permissions. Those device-dependent interactions are not represented as verified unless tested on a configured machine. Gesture quality can vary with lighting, camera placement, and hand position; this is a small desktop prototype, not an accessibility or medical device.
Frames are processed locally by the application and are not uploaded by this code. The program has access to the webcam while running and can send desktop pointer actions after control is enabled. PyAutoGUI's fail-safe stays enabled; if it triggers during a mouse action, the application reports it and stops. Use the app only in a trusted local session. Sustained arm positioning can cause fatigue, and precise work may be difficult.
The core workflow is a native desktop application. Vercel cannot provide its local webcam, interactive OpenCV preview, or OS-level pointer control. The self-contained site/ directory is a static project presentation only; it has no camera access or interactive gesture demo. It is deployed at gesture-controlled-virtual-mouse.devayushrout.me from the site/ directory using Vercel's Other framework preset with no build or output commands. The hosted page does not run the desktop application.
main.py: webcam loop, hand landmark processing, gesture recognition, preview window, and desktop actions.fixed_main.py: alternate implementation retained in the repository; the documented entry point ismain.py.check_installation.py: local environment and device check.report.md: original academic-style project report. Some reported results and features are not verified by this repository's automated checks; treat them as historical project claims.
No license file is currently included. Check with the project owner before reusing or distributing this code.

