A really simple eyetracker

Another project that I wanted to share was a really simple-to-build eyetracker.

OLYMPUS DIGITAL CAMERAOLYMPUS DIGITAL CAMERAIt is basically just an old specs-frame with 3 webcams mounted on it – 2 pointing on either eye, the 3rd pointing ahead capturing the subjects field of view. Excuse the cloggy things wrapped in brown tape. They are the voltage regulator circuits for the (formerly internal) display cams that require 3.3V instead of the 5V that your external USB provides:


The eyetracker can sample at ~30Hz (depending on what cameras you use). A drawback is that you need 3 unoccupied USB-ports and your bus or video4linux might not support 3 simultaneous video streams.


The C++ code I wrote uses OpenCV to capture the image frames. During runtime you can calibrate the algorithm as follows:

Click into the window of either eye and draw a ROI (region of interest = blue square) by holding down the left mouse-button. The program will only search for irises with their center within the ROI. When holding down the right mouse-button you can draw a circle that has the approximate size of the iris so that the algorithm knows what kind of circles to search for. Then by clicking on points in the middle view whilst looking at the same points in the real world you can calibrate the program so that it knows what positions of the iris correspond to what positions in the middle view. I’m only using the last 3 calibration points and a perspective transform that does not correct for the spherical shape of the eye. However by mapping the entire field of view and applying some other co-registration function one could probably improve the result a lot. The iris-detection could use improvement as well since I’m only using the ‘HoughCircles’-function; well it’s work in progress. (It would probably be better to detect the pupil instead of the iris anyway.)

However if the calibration went well the blue dot in the middle-image should show where the eye is looking.


Leave a comment

Filed under Electronics

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s