Previous posts

EyePrints - Post 1 - Introduction

EyePrints - Post 2 - Installing OpenCV - Prerequisites

EyeLiner - Post 3 - Installing OpenCV

 

PyGaze is an open-source toolbox for eye tracking in Python.

 

Pygaze is an open-source toolbox for eye tracking in Pyton.

To install PyGaze, let's first install some dependencies. Type the following into the terminal.

 

sudo apt-get install python-numpy python-scipy python-matplotlib python-imaging python-pygame psychopy python-pyglet

 

This will install (in order): NumPy, SciPy, Matplotlib, PIL, PyGame, PsychoPy, and pyglet. Probably some of these packages have been already installed, but let's do it again to stay om the safe side

 

Site-Packages Directory

Installing PyGaze requires copying the PyGaze directory into Python’s site-packages directory. First check where this directory is located. One way to do this is with Python. In the terminal, type:

 

python

 

To check the site-packages directory, type the following in the Python console:

 

>>> import site; site.getsitepackages()

 

This will list your site-packages directory. One of the directories I see listed is:

 

/usr/local/lib/python2.7/dist-packages/

 

Exit the Python console by typing:

 

>>> quit()

Install PyGaze

In order to install PyGaze, download the latest version of pygaze from github

 

$ wget https://github.com/esdalmaijer/PyGaze/archive/master.zip

 

Go to the directory where the download was saved (for me, cd ~). To unzip PyGaze, in the terminal type:

 

unzip pygaze.zip

 

To copy the unzipped PyGaze directory into the site-packages directory, type the following in your terminal (of course, you should use the site-packages directory you got from above):

 

sudo cp -r pygaze /usr/local/lib/python2.7/dist-packages/

 

Set the permissions to drwxr-sr-x:

 

sudo chmod 2755 -R /usr/local/lib/python2.7/dist-packages/pygaze/

Testing

To test if everything is ok, I opened a python console and tried to import the pygaze module

 

$ python
>>> import pygaze

 

I got no errors, so everythink should be ok

 

Getting Started With PyGaze

In the zip file we just downloaded, there are several example experiments located in the directory pygaze/examples/. Unfortunately they do not run with a webcam, but requires a commercial eyetracker (currently EyeLink 1000, SMI RED and Tobii TX300 are supported). A dummy eyetracker is supported: the eye movements can be simulated using the mouse to test the experiments you are devising.

So for the moment, I was oly able to run the project in the show_webcam folder, that simply shows the output of the webcam

 

Pygaze1.png