When I started working with C++ interface for Eye Tribe
(Eye Tracker) I didn't find any example to visualize gaze points Live. However, there are example programs which print GazeData
onto console. Hence, I decided to write a wrapper around C++ interface for Eye Tribe to visualize gaze data on a simple console application.
Before I get started, I would like to share my experience working with Eye Tribe.
I had used Eye Trackers from other vendors which are mostly wearable. The issue with wearable Eye Trackers is they can only be used for short studies or some diagnostic tests. However, wearable Eye Trackers are not widely used as a primary means of interacting with a system. The reason is obvious, either wearable Eye Trackers are heavy and/or users feel uneasy wearing these eye trackers while they work on a computer.
Eye Tribe is a game changer in this regard. Once calibrated with a good rating, its accuracy is unquestionable. I have been using Eye Tribe for more than 6 months and never ran into a situation demanding better accuracy. I can go on exalting the capabilities of Eye Tribe, however, this article is created for a different purpose.
Let's get back to the topic, the goal is to create a Live Gaze Visualizer for Eye Tribe.
Steps to deploy this project:
Step 1: Download and Install Boost C++ Libraries
Step 2: Download or Clone Eye Tribe C++ SDK from GitHub
- Download Boost C++ libraries from here
- Version to be used: 1.57.0 or higher
- If you are using Windows operating system, follow the instructions on Boost-Getting Started on Windows to understand how to use Boost Libraries.
- According to the Boost documentation- "Most Boost libraries are header-only: they consist entirely of header files containing templates and inline functions, and require no separately-compiled library binaries or special treatment when linking."
- Only a few libraries have to be built, this can be achieved through "Boost.Build" system.
Step 3: Handling Graphics
- You don't have to build any libraries, but all you need to do is include "gazeapi.h" to the project.
Step 4: Create Visual Studio Win32 Console Project - Gaze Visualizer
- I am assuming that "Visual Studio" is your IDE, and if it is the graphics header "Graphics.h" is not supported.
- University of Colorado has implemented a mechanism for using the WinBGIm Graphics Library from Visual Studio (2005/2008 or higher).
- Download the WinBGIm Graphics Library from here
- You would need two files from "WinBGIM" implementation: Winbgi.cpp, and graphics.h
- Create a Win32 console project.
- Select option "Empty Project, " and don't include any pre-compiled headers.
- In project properties set the header paths. In my case it is
- C:\Program Files\boost\boost_1_57_0\
- Under Linker -> General option, set Additional Library Directories
- C:\Program Files\boost\boost_1_57_0\stage\lib\
- C:\Program Files\boost\boost_1_57_0\libs\
- Add source files (*.cpp) from Eye Tribe SDK to the project
- Add Winbgi.cpp, and graphics.h to the project
- The file "EyeTracker.cpp" (shared on GitHub) implements the Gaze Visualizer.
- Built the project.
- Connect Eye Tribe to the system, and calibrate.
- Run the application and you will see circles drawn on the console showing the Gaze points.
- These points are also encoding pupil size.
Feel free to contact me should you have queries.