A lightweight, robust 3D eye tracker in Python
This repository is an open-source 3D eye tracking algorithm written in Python. Currently, it is an updated version of the pupil tracker from https://github.com/YutaItoh/3D-Eye-Tracker/blob/master/main/pupilFitter.h that has been optimized, simplified, and improved upon.
To use the script, run "python .\OrloskyPupilDetector.py" from your shell. If the hardcoded file path in the select_video() function does not find a video at the specified path, it will open a browse window that allows you to select a video. The process_video() function handles the majority of the processing and can be easily modified to work with a camera capture or image. It returns a rotated_rect that represents the pupil ellipse. A lite version is also included that is more efficient, but less robust. Be sure to have an adequate light source for the lite version.
A test video (eye_test.mp4) is included in the root directory for testing. Algorithm details are explained here: https://www.youtube.com/watch?v=bL92JUBG8xw
When running the script on this test video, your results should look like this: https://youtu.be/B06cUMplDHw.
If you need an eye camera with custome LEDs, I have instructions for building your own IR camera for under $100 here: https://www.youtube.com/watch?v=8lZqCMRMtC8 Alternatively, there is a small $17 IR camera that works well with some modification: https://amzn.to/41x8p2W
To help support this software and other open-source projects, please consider subscribing to my YouTube channel: https://www.youtube.com/@jeoresearch, or joining for $1 per month: https://www.youtube.com/@jeoresearch/join.
Other useful tools/supplies
As an Amazon Associate, I earn from qualifying purchases at no extra cost to you.
Requirements:
Packages
Assumptions
2,928 followers · starred Dec 2025
10 followers · starred Sep 2025
57 followers · starred Aug 2026
15 followers · starred Aug 2026
A lightweight, robust 3D eye tracker in Python
This repository is an open-source 3D eye tracking algorithm written in Python. Currently, it is an updated version of the pupil tracker from https://github.com/YutaItoh/3D-Eye-Tracker/blob/master/main/pupilFitter.h that has been optimized, simplified, and improved upon.
To use the script, run "python .\OrloskyPupilDetector.py" from your shell. If the hardcoded file path in the select_video() function does not find a video at the specified path, it will open a browse window that allows you to select a video. The process_video() function handles the majority of the processing and can be easily modified to work with a camera capture or image. It returns a rotated_rect that represents the pupil ellipse. A lite version is also included that is more efficient, but less robust. Be sure to have an adequate light source for the lite version.
A test video (eye_test.mp4) is included in the root directory for testing. Algorithm details are explained here: https://www.youtube.com/watch?v=bL92JUBG8xw
When running the script on this test video, your results should look like this: https://youtu.be/B06cUMplDHw.
If you need an eye camera with custome LEDs, I have instructions for building your own IR camera for under $100 here: https://www.youtube.com/watch?v=8lZqCMRMtC8 Alternatively, there is a small $17 IR camera that works well with some modification: https://amzn.to/41x8p2W
To help support this software and other open-source projects, please consider subscribing to my YouTube channel: https://www.youtube.com/@jeoresearch, or joining for $1 per month: https://www.youtube.com/@jeoresearch/join.
Other useful tools/supplies
As an Amazon Associate, I earn from qualifying purchases at no extra cost to you.
Requirements:
Packages
Assumptions
2,928 followers · starred Dec 2025
10 followers · starred Sep 2025
57 followers · starred Aug 2026
15 followers · starred Aug 2026