How gedeananda/python-handtrack works
Retrolens is a webcam-based hand-tracking filter app. Its main workflow captures a frame, detects hand landmarks, uses gestures to select a filter and define a four-point portal, processes the portal region, then displays the result. The README also documents eleven filters, including Galaxy background replacement; the segmentation model is optional at runtime. The implementation is concentrated in main.py, so several distinct responsibilities share that path. Relationships below are supported by the excerpted source or README.
Main entry points: main.py Frame Loop · hand_landmarker.task Hand Model · selfie_segmenter.tflite Segmentation Model
Components 15
Capture and Perception
- Frame Loop
main.py - Hand Detection
main.py - Hand Model
hand_landmarker.task - Person Segmentation
main.py - Segmentation Model
selfie_segmenter.tflite
Gesture and Portal
- Gesture Filter Switch
main.py - Portal Geometry
main.py - Active Filter
main.py
Filter Rendering
- Galaxy Background
main.py - Filter Engine
main.py - Portal Composite
main.py - Camera Display
main.py
Other components
- User
- Webcam
- Display
Connections 20
- Webcam → Frame Loop: provides frames
main.py - Frame Loop → Hand Detection: submits frames
main.py - Hand Detection → Hand Model: loads model
main.py - Hand Detection → Gesture Filter Switch: returns landmarks
main.py - Hand Detection → Portal Geometry: returns landmarks
main.py - Frame Loop → Person Segmentation: requests mask
main.py - Person Segmentation → Segmentation Model: loads model
main.py - Gesture Filter Switch → Active Filter: advances filter
main.py - Portal Geometry → Filter Engine: supplies region
main.py - Active Filter → Filter Engine: selects filter
main.py - Person Segmentation → Filter Engine: supplies mask
main.py - Galaxy Background → Filter Engine: supplies background
main.py - Frame Loop → Galaxy Background: creates background
main.py - Filter Engine → Portal Composite: returns filtered region
main.py - Portal Geometry → Portal Composite: supplies polygon
main.py - Frame Loop → Camera Display: sends frame
main.py - Portal Composite → Camera Display: updates frame
main.py - User → Gesture Filter Switch: makes gestures
README.md - User → Camera Display: presses q
main.py - Camera Display → Display: shows frame
main.py