Control your computer cursor through gestures and computer vision, without needing to touch the physical mouse.
New Features
- Right Click: Ring finger extended activates right click.
- Dynamic Hand Detection: White circle indicator on wrist when hand is closed.
- Single Hand Tracking: When fully opened, system locks to that hand (eliminates cross-hand detection).
Improvements
- Visual Feedback Enhancements: Improved finger indicators (colors, sizes, and timing).
- Performance Improvements: Removed unnecessary processes like lighting processing.
- Cursor Stabilizer: Added a momentary freeze when exiting Precision Mode to prevent cursor jumps.
- Anatomical Assist: Algorithm to infer Ring finger position when partially occluded by the Pinky.
- Python 3.10 or higher
- A Webcam connected
- Open terminal in the project folder.
- Create virtual environment (optional but recommended):
python3 -m venv venv
- Activate environment:
source venv/bin/activate - Install dependencies:
pip install opencv-python mediapipe pyautogui sounddevice numpy
- Run:
python main.py
- Open CMD or PowerShell in the project folder.
- Create virtual environment (optional but recommended):
python -m venv venv
- Activate environment:
venv\Scripts\activate
- Install dependencies:
pip install opencv-python mediapipe pyautogui sounddevice numpy
- Run:
python main.py
Lock/Unlock hand: Your closed fists will show a white circle on the wrist. Open the hand you want to use completely - this will lock that hand for tracking. To unlock, simply close the fist again.
-
Move cursor: Raise your index finger (lights up Green) to drag the cursor with high sensitivity.
-
Click and Precision Mode: While raising your index, raise your pinky finger (lights up Red). To click, quickly retract and extend the pinky again (double-tap gesture).
-
Hold click to drag: While dragging the cursor, raise your middle finger (lights up Orange). Keep it extended for a moment until it turns Blue - now click is held, allowing drag & scroll.
- Method 1: Raise your ring finger alone (lights up Orange), hold briefly until Blue for right click.
- Method 2 (Ergonomic): Raise middle + ring fingers together (4 fingers max)
"Stop!": Open your hand completely - all fingers light up Red and the system pauses.
Consideration: Lighting conditions can affect gesture recognition. Adjust parameters in config.py for optimal performance.
Customize system behavior by modifying these key parameters:
FRAME_WIDTH/FRAME_HEIGHT: Resolution (default 640x480 for better precision)FPS_TARGET: Capture speed
MIN_DETECTION_CONFIDENCE: Detection thresholdMODEL_COMPLEXITY: 0 (Fast) or 1 (Accurate, default)
SENSITIVITY: Cursor speedSMOOTHING_FACTOR: Reduces hand shake/jitter
PINKY_TRIGGER_RATIO: Click sensitivityDRAG_ACTIVATION_TIME: Hold time before drag activates
SHOW_DEBUG_WINDOW: Enable/disable visual feedback window
Note: Individual modules can be further customized for specific needs.
- Dynamic dual-hand detection with visual wrist indicators.
- Single active hand tracking system (prevents interference).
- Right click: ring finger extended.
- Alternative right click: middle + ring (ergonomic 4-finger mode).
- Enhanced visual feedback for hand states.
- Performance optimizations.
- Basic cursor control via index finger.
- Click functionality with pinky.
- Drag-and-hold with middle finger.
- Emergency stop gesture.
- Configurable sensitivity and smoothing.
MIT License - See LICENSE for details.
Feel free to open issues or submit pull requests for improvements!