Skip to content

toshikurauchi/tobii_stream_py

Repository files navigation

Python Tobii Stream API

Simple wrapper for Tobii Stream API (Windows Only).

Dependencies

  1. Cython: pip install cython

Installing

  1. Clone this project
  2. Install Tobii Eye Tracking Core Software
  3. Download Stream Engine 3.3.0 for Windows x86 (it must be x86 even if you are using a 64-bit Windows because Python needs the 32-bit library), or the latest version available here
  4. Extract the files
  5. Move tobii_stream_engine.dll and tobii_stream_engine.lib from lib/tobii to this project's root directory
  6. Move tobii directory from include to this project's include directory
  7. Run python setup.py install

Usage

An example is provided in tobii_client_test.py.

api = tobii_client.TobiiAPI(gaze_callback)
api.start_stream()
time.sleep(1)
api.stop_stream()

You can alternatively use the with statement, which will call start_stream() and stop_stream():

with tobii_client.TobiiAPI(gaze_callback) as api:
    time.sleep(1)

The TobiiAPI object requires a callback function with a single argument. The callback function will be called for every new gaze sample. The gaze sample is represented by a namedtuple with the following fields:

  • timestamp: integer timestamp value, as provided by Tobii Stream Engine
  • valid: boolean indicating whether this sample is valid or not
  • x: float in range [0, 1] (normalized screen size)
  • y: float in range [0, 1] (normalized screen size)

Releases

No releases published

Packages

No packages published