HandFlow is a Python-based virtual mouse controller that uses your webcam and hand gestures to control your computer mouse in real time.
It uses:
- OpenCV for webcam capture and rendering
- MediaPipe for hand tracking
- Mouse library for controlling the cursor
- Real-time hand tracking
- Smooth mouse movement
- Left click gesture
- Right click gesture
- Adjustable sensitivity and smoothing
- Deadzone filtering for stability
- The wrist/base landmark (
landmark[0]) controls the mouse movement. - Cursor movement is smoothed using linear interpolation (
lerp).
- Touching the thumb and index finger triggers a left click.
- Touching the thumb and middle finger triggers a right click.
| Gesture | Action |
|---|---|
| Thumb + Index Finger | Left Click |
| Thumb + Middle Finger | Right Click |
| Move Hand | Move Cursor |
Press Q |
Quit Application |
- Clone the repository:
git clone https://github.com/Nullit13/handflow.git
cd handflow- Install dependencies:
pip install -r requirements.txt- Run the application:
python main.pyYou can modify these values in the script:
sensitivity = 3
smoothTime = 0.25
deadzone = 1sensitivityβ Cursor movement speedsmoothTimeβ Cursor smoothing amountdeadzoneβ Minimum movement before cursor moves
- Ensure your webcam is connected and accessible.
- Good lighting improves hand detection accuracy.
- Screen resolution is currently set manually:
screen_w, screen_h = 1920, 1080Adjust this to match your monitor resolution.
- Multi-hand support
- Gesture customization
- Drag-and-drop gestures
- Scroll gesture support
- Automatic screen resolution detection
This project is open-source and free to use.