https://github.com/grebtsew/tobii_glasses_2_python3_and_c
Example showing how to get and visualize data_stream, scene camera stream and eye camera stream.
https://github.com/grebtsew/tobii_glasses_2_python3_and_c
c-plus-plus eye-camera-stream opencv-python python python-requests python3 scene-camera-stream tobii tobii-eye-tracker tobii-glasses-2 tobii-pro-glasses-2 visualize-data-stream
Last synced: 10 months ago
JSON representation
Example showing how to get and visualize data_stream, scene camera stream and eye camera stream.
- Host: GitHub
- URL: https://github.com/grebtsew/tobii_glasses_2_python3_and_c
- Owner: grebtsew
- Created: 2018-06-27T18:48:22.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-09-27T19:35:44.000Z (over 6 years ago)
- Last Synced: 2025-04-15T00:54:05.010Z (about 1 year ago)
- Topics: c-plus-plus, eye-camera-stream, opencv-python, python, python-requests, python3, scene-camera-stream, tobii, tobii-eye-tracker, tobii-glasses-2, tobii-pro-glasses-2, visualize-data-stream
- Language: Python
- Size: 30.3 KB
- Stars: 9
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tobii_Glasses_2_Python3_And_C++
Example showing how to get and visualize data_stream, scene camera stream and eye camera stream.

# Start
1. Clone or download this repo.
2. Connect to your glasses.
3. Change ip and port in all files, if you are not using default.
4. Run:
```
python starter.py
```
# Motivation
If you prefer `Python3` over `Python2` there are no examples published by `Tobii Pro` of how to connect to `Tobii Glasses 2`. Therefore I made this implementation for `Python3` where we use `requests` instead of `urllib2`. If you prefer `C++` over `Python` you can check out the C++ implementation.
# Requirements Python3
These are the required imports for Python3:
* requests
* cv2
# Requirements C++
The C++ implementation is developed in Visual Studio 2017 on Windows 10.
These NuGet Packages are used:
* cpprestsdk.v.141 version v2.10.7 (for rest api calls)
* opencv.win.native version v320.1.1-vs141 (require build to be in x64 and in release)
* opencv.win.native.redist v320.1.1-vs141
Some security settings had to be changed in visual studio 2017:
Project -> Project Properties -> C/C++ -> Preprocessors -> Add Preprocessor Definitions :
`_WINSOCK_DEPRECATED_NO_WARNINGS; _CRT_SECURE_NO_WARNINGS;`
# About
Tobii Glasses 2 is a nifty device produced by Tobii Pro. The product is full of useful components and intresting functions. Such as eye tracking, gyroscope, pupil size and 3d directions. Data from Tobii Glasses 2 is received using udp sockets. From the incoming json objects data can be received and filtered by using these conditions:
```
# Data gathering
if (str(data).__contains__("ac")): #accelerometer
if (str(data).__contains__("pd")): #pupil-diameter
if (str(data).__contains__("gd")): #gaze-direction
if (str(data).__contains__("gp\"")): #gaze-position
if (str(data).__contains__("gp3")): #gaze-position-3d
if (str(data).__contains__("gy")): #gyro-scope
if(str(data).__contains__("\"pts")):
if (str(data).__contains__("left"): #left eye
if (str(data).__contains__("right"): #right eye
```
# See also
A great example (python2):
https://github.com/ddetommaso/TobiiProGlasses2_PyCtrl
This code assume from example files in Tobii Glasses 2 API examples:
https://www.tobiipro.com/product-listing/tobii-pro-glasses-2-sdk/
With the download above follows a developers documentation which helps alot!