最近在使用Tobii眼动设备的时,需要使用python的SDK来启动眼动设备进行数据采集。踩了一些坑,记录一下操作流程:
在使用网口链接eye tracker的时候,我的电脑是Win10家庭版,只要同时连上WIFI就无法通信。所以建议关掉无线连接。
tobii_research库安装
按照官网指导的方法安装时,发现找不到库。
pip install tobii_research
解决方案:这个库在python3.7以上的版本不支持,需要重新建立一个3.6的python环境进行安装。
Getting_Started
官方提供了一个Getting_Started的demo演示如果通过SDK实现眼动采集的基本流程。即以下四个流程。
- Browsing for eye trackers or selecting an eye tracker with known address.
- Establishing a connection with the eye tracker.
- Running a calibration procedure in which the eye tracker is calibrated to the user.
- Setting up a subscription to gaze data, and collecting and saving the data on the computer running the application. In some cases, the data is also shown live by the application.
import tobii_research as tr
import time
found_eyetrackers = tr.find_all_eyetrackers()
my_eyetracker = found_eyetrackers[0]
print("Address: " + my_eyetracker.address)
print("Model: " + my_eyetracker.model)
print("Name (It's OK if this is empty): " + my_eyetracker.device_name)
print("Serial number: " + my_eyetracker.serial_number)
def gaze_data_callback(gaze_data):
# Prin