The problem
Where someone looks is rich information — for attention studies, hands-free interface experiments, usability testing — but commercial eye trackers are specialized hardware. A laptop webcam plus classical computer vision gets surprisingly far: the geometry of the eye is stable, the pupil is the darkest blob in the eye region, and a short calibration turns pupil positions into screen coordinates. This project builds that pipeline with dlib's 68-point landmark model (Kazemi and Sullivan, 2014), pupil-center estimation by image moments, and a 9-point calibration grid that fits a polynomial mapping per user.
Because every face, webcam and lighting setup differs, accuracy is personal: the included notebook runs a calibration procedure the buyer performs, then computes mean angular error over the calibration points, so the report's numbers come from the buyer's own run. The design target is a few degrees of mean angular error at typical laptop distance in good lighting — and the limitations section is blunt about when it breaks: poor light, glasses glare, head movement after calibration. MPIIGaze (Zhang et al., 2017) is cited as the deep-learning background reference for what appearance-based gaze estimation looks like at research scale.
How it works
- The webcam frame is passed to dlib's face detector and the 68-point landmark predictor.
- Eye regions are cropped from landmarks 36-47 and converted to grayscale.
- The pupil blob is isolated by adaptive thresholding and its center found with image moments.
- During calibration, the user looks at nine on-screen targets while pupil positions are recorded.
- A polynomial mapping is fit from pupil-center vectors to screen coordinates for that user.
- In tracking mode, each frame's pupil centers are mapped through the calibration to a gaze point, drawn live on screen.
Tech stack:
- Python 3.10, dlib (face detection, 68-point landmarks)
- OpenCV (frame capture, eye cropping, thresholding)
- NumPy (pupil geometry and mapping math)
- scikit-learn (polynomial calibration fit)
- Jupyter notebook (calibration procedure and error analysis)
- Matplotlib (calibration grid and residual plots)
- Tkinter overlay app (calibration targets and live gaze point)
| Parameter | Value |
|---|---|
| Landmarks | Dlib 68-point model (Kazemi and Sullivan, 2014) |
| Pupil estimation | Adaptive thresholding with image-moment centroid |
| Calibration | 9-point on-screen grid, per-user polynomial mapping |
| Accuracy | Design target of a few degrees mean angular error at laptop distance, measured by the buyer's own calibration run |
| Output | Live gaze-point overlay, session gaze heatmap |
| Reference | MPIIGaze (Zhang et al., 2017) as deep-learning background |
Project features
- Dlib 68-point facial landmark detection for precise eye-region localization
- Pupil-center estimation from thresholded pupil blobs via image moments
- 9-point on-screen calibration procedure with per-user mapping fit
- Real-time gaze-point overlay on the screen during tracking
- Gaze heatmap logging: dwell points recorded over a session
- Calibration-quality report with per-point residuals
- Evaluation notebook computing mean angular error on the buyer's own calibration run
- Head-pose gating that pauses tracking when the head moves too far
What is included
- Complete source code (landmarks, pupil estimation, calibration, tracking overlay)
- Jupyter calibration and evaluation notebook (procedure, angular-error computation, residual plots)
- Project report PDF (background, eye geometry, calibration method, buyer-run evaluation, limitations)
- PPT presentation for final review
- Viva Q&A preparation document (dlib landmarks, pupil detection, calibration math, MPIIGaze context)
- Setup guide (environment, dlib model download, webcam setup, running calibration)
Limitations & prerequisites
- Lighting is the dominant failure mode: pupil thresholding degrades in dim or strongly backlit rooms, and the report documents the lighting conditions the evaluation was run under.
- The calibration is valid only for the head position held during calibration; leaning in, turning or slouching afterward shifts the mapping until recalibration.
- Glasses glare, heavy eyeliner and drooping eyelids can occlude the pupil blob and break center estimation for those users.
- This is an educational attention-tracking prototype, not a medical or assistive device — it must not be used for diagnosis, accessibility-critical control or any safety-relevant purpose.
Frequently Asked Questions
How is gaze accuracy measured?
By you: the calibration notebook records your pupil positions on the 9-point grid and computes mean angular error in degrees of visual angle, so the report documents your own run's number rather than a claimed one.
Why dlib instead of a deep gaze network?
The geometric route — landmarks plus pupil blob plus calibration — is transparent, runs on CPU with no training data, and every stage is explainable in a viva. MPIIGaze-style appearance models are cited as the research-scale alternative.
What is MPIIGaze?
The standard in-the-wild gaze dataset and appearance-based baseline from Zhang et al. (2017): hundreds of thousands of face images with gaze labels, used here as background context rather than training data.
Do I need to recalibrate?
Once per seating position. The mapping is fit to your face, webcam and head position; moving the laptop or shifting posture calls for a fresh 30-second calibration.
Does it work with glasses?
Sometimes — it depends on glare and frame occlusion. The limitations section documents this openly, and the calibration residuals will tell you immediately if your setup is unsuitable.
Can it track both eyes?
Yes — pupil centers from both eyes are estimated per frame and averaged into a single gaze vector, which also adds robustness when one eye is briefly occluded. Suitable for B.E./B.Tech final-year projects in Computer Science, AI/ML and Data Science.
Components & software requirements
- Python 3.10, dlib (face detection, 68-point landmarks)
- OpenCV (frame capture, eye cropping, thresholding)
- NumPy (pupil geometry and mapping math)
- scikit-learn (polynomial calibration fit)
- Jupyter notebook (calibration procedure and error analysis)
- Matplotlib (calibration grid and residual plots)
- Tkinter overlay app (calibration targets and live gaze point)
Delivery information
Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.
Support terms
Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.