Overview
virtualmouse controls the operating system’s mouse cursor using webcam-based hand tracking. It supports moving and clicking the cursor with a single camera via hand landmarks, triangulating a 3D fingertip position from two cameras, or tracking a colored physical marker instead of a hand.
Features
- Single-camera mode: index fingertip moves the cursor, a pinch gesture clicks, a fist pauses tracking
- Stereo mode: two webcams triangulate a 3D fingertip position, and touching a virtual screen plane clicks
- Nine-point on-screen calibration routine per camera
- Colored-marker tracking mode as an alternative to hand landmarks
- HSV trackbar tool for tuning marker color ranges
- Configurable cursor smoothing and a deadzone to reduce jitter
- Configurable pinch-click thresholds and a click “rewind” that favors the cursor position just before the pinch
- Live FPS overlay on the camera preview window
How it works
Hand tracking uses MediaPipe’s HandLandmarker to find fingertip positions from webcam frames. Cursor movement is smoothed with a One Euro filter and a deadzone before being applied via PyAutoGUI. In stereo mode, OpenCV’s calibration and triangulation functions compute a 3D fingertip position from two synchronized cameras and intersect it with a virtual plane representing the screen.