How frosty-8/eye-cursor works
Project type and purpose
• This is a single-module Python computer-vision application that tracks eye landmarks via MediaPipe/OpenCV, detects blinks, and issues system mouse commands with PyAutoGUI. Its core purpose is real-time, hands-free cursor movement and click control.
File structure
• Top-level:
• main.py – the entire application
• Makefile – setup automation
• requirements.txt – dependencies
• No separate frontend/backend, no database; it’s a simple pipeline: camera in → ML/CV processing → OS interaction.
README for insights
• Dependencies: mediapipe, opencv-python, pyautogui
• Workflow described: FaceMesh → extract right-eye landmarks for movement → blink detection for clicks → PyAutoGUI issues mouse events.
• No external services, no multi-stage build beyond Python venv.
a. Main components:
1) Input Device – Webcam
2) Video Capture Module (OpenCV)
3) FaceMesh Engine (MediaPipe)
4) Landmark Processor (separate routines in main.py)
• Eye-movement mapper
• Blink detector
5) Cursor Controller (PyAutoGUI interface)
6) User Interface / CLI (captures ‘Q’ to exit)
b. Relationships & data flow:
• Webcam → Video Capture → FaceMesh Engine
• FaceMesh Engine → Landmark Processor
• Landmark Processor → Cursor Controller → OS Mouse API
• CLI monitors keypress events in parallel, feeding back to terminate pipeline
c. Architectural patterns & design principles:
– Pipeline pattern: sequential processing stages
– Single-threaded loop orchestrating capture, processing, actuation
– Clear separation of concerns: capture vs. ML vs. I/O
d. Key technologies & libraries:
– OpenCV (cv2) for frame acquisition and pre/post-processing
– MediaPipe FaceMesh for real-time landmark detection
– PyAutoGUI for OS-level mouse events
– Python 3.x runtime and standard libraries