Simple gaze tracking in Python that uses an gradient-based algorithm by Timm & Barth to locate iris centers
- Localize centers of irises.
- Find faces in image.
- Get rough eye regions using hard-coded face proportions.
- Locate the iris center for each eye region.
1. Compute x and y image gradients.
2. Compute normalized gradient vector (gi) for each pixel.
3. Test each pixel as a possible center.
- Use each pixel's gradient vector.
- Compute normalized displacement vector (di) from possible center to position of gradient vector.
- Compute dot product of (di) and (gi), and add result to a sum for that possible center.
- If the sum for that possible center is greater than the previous max sum, store the coordinates of the possible center and update the max sum. 4. Mark the coordinates for the possible center with the max sum as the center of that eye's iris.
- Find reference points outside irises.
- Compare iris centers with reference points to determine gaze direction.
Timm, F., & Barth, E. (2011, March). Accurate Eye Centre Localisation by Means of Gradients. In VISAPP (pp. 125-130).
http://www.inb.uni-luebeck.de/publikationen/pdfs/TiBa11b.pdf