Building an open source eye tracker

My name is Paolo Casas and this summer I had the opportunity of working at the Chand Lab in the Department of Anatomy & Neurobiology and the Department of Psychological and Brain Sciences at Boston University. I am a rising junior studying biomedical engineering and computer science, I was a member of the varsity swim team at BU for two years, and this upcoming fall I will be spending the semester abroad at the National University of Singapore. 

My two month summer project was to develop a C++ eye-tracking application that Chand and other scientists would be able to use in neuroscience and psychological experiments. Currently there are commercial eye-trackers that are available for purchase but can cost upwards of $10,000. Furthermore, commercial eye-trackers, often incorporate proprietary software which limits the researcher’s ability to get “under the hood” and modify the program for their specific needs. Luckily for me, I was able to take advantage of prebuilt API’s and libraries that I could just incorporate into my code. 

At first, I thought that this would be a relatively easy task because I didn’t need to code everything from scratch and could just call the blob detection function from OpenCV (a computer vision library) on the frames. However, building a real-time system proved to be much more difficult than initially expected as I had to deal with issues concerning type conversions, memory limitations and hierarchy, buffer overflows, compiling, and linking. Despite that, I was able to get a working version of my eye-tracker up and running relatively quickly. The only problem was that for Chand’s purposes and research purposes in general, the rate at which the camera captured and processed images was far too slow. Thus, to speed up the application I created a threaded model which can sufficiently keep up with the 728 fps capture rate of the camera. 

Although I only spent two months working with Chand, I learned a lot and was able to further deepen my knowledge of computer science and software development as applied to neuroscience and psychology. To name a few, some of the things that I picked up during my time with Chand are: how to create a makefile, becoming familiar with GitHub, working in a linux system, creating shared memory spaces, how to set up data transmission sockets, mutex_locks, markdown and bib files, and most notably creating a multi-threaded application. Currently, the software is pending submission for the Journal of Open Source Software so others may also benefit from this low cost but effective eye tracker. Working with Chand has been a very rewarding experience and I am excited to visit the lab in the Spring once the lab is fully up and running.

Example of eye tracking in progress.

View all posts