How antoinelame/gazetracking works
Main Components
• Demo/Client Layer: Represented by the example.py script which initiates the webcam capture using OpenCV and uses the GazeTracking class for processing.
• GazeTracking Library (gaze_tracking package): The core package contains modules like calibration.py, eye.py, gaze_tracking.py, and pupil.py. This layer encapsulates the processing logic (calibration routines, eye detection, pupil localization, gaze calculations).
• Trained Models: Under gaze_tracking/trained_models, include the dlib landmark predictor (shape_predictor_68_face_landmarks.dat) that is essential for facial feature extraction.
• External Dependencies: Highlight external libraries such as OpenCV for video capture and image processing, dlib for facial landmark detection, and NumPy as a supporting math library.
Relationships and Data Flow
• From example.py, the video frame is passed to the GazeTracking instance (invoking gaze_tracking.refresh(frame)).
• Inside the GazeTracking module, detail the pipeline:
• The calibration module processes the frame.
• The eye and pupil modules further extract the relevant regions (or coordinates).
• The gaze_tracking module uses these outputs along with the pre-trained model to compute gaze directions and other metrics.
• Finally, the annotated_frame() is produced and passed back to the output/display (using OpenCV’s imshow).
Architectural Patterns
• Pipeline Processing: Show a sequential flow from frame capture → calibration → landmark/eye detection → gaze computation → annotation.
• Modularity: Separate blocks for each processing module (calibration, eye tracking, pupil detection) reinforce clear responsibilities.