Install GazeParser (Linux)
==================================

Dependencies
-------------------------

**Python 3.6** or later is necessary to use GazePaser.
GazeParser depends on following Python modules.

- **numpy**
- **scipy**
- **matplotlib**
- **PIL (Python Imaging Library)**
- **wxPython** (for data viewer)
- **PsychoPy** (experimental control library)

.. note::
     * VisionEgg backend is no longer supported by 0.11.0 or later.

Download
---------------------------

GazeParser installer can be downloaded from following page.

`<http://sourceforge.net/projects/gazeparser/files/>`_

Install either of two files to computers which you plan to use stimulus presentation and data analysis.

- `GazeParser-0.12.0.zip <https://sourceforge.net/projects/gazeparser/files/GazeParser/0.12.0/GazeParser-0.12.0.zip>`_
- `gazeparser_0.12.0_all.deb <https://sourceforge.net/projects/gazeparser/files/GazeParser/0.12.0/gazeparser_0.12.0_all.deb>`_

If you download .zip archive, expand it and run 'python setup.py install'. *You may need root privilege to complete installation*.
If you download .deb installer, run 'sudo dpkg -i gazeparser_0.12.0_all.deb'.

If you plan to record gaze data, download .deb installer. 
If your system doesn't support .deb installer, download source code and build SimpleGazeTracker.

- `simplegazetracker_0.12.0_amd64.deb <https://sourceforge.net/projects/gazeparser/files/SimpleGazeTracker/0.12.0/simplegazetracker_0.12.0_amd64.deb>`_ (OpenCV edition)
    For cameras supported by OpenCV VideoCapture. Necessary interfaces, drivers and other applications depend on camera unit.  Confirm user manual of the camera.

- `simplegazetracker-flycap_0.12.0_amd64.deb <https://sourceforge.net/projects/gazeparser/files/SimpleGazeTracker/0.12.0/simplegazetracker-flycap_0.12.0_amd64.deb>`_ (FlyCapture2 edition)
    For FlyCapture2 cameras. FlyCapture2 software must be installed to the recording PC.

- `simplegazetracker-spinnaker_0.12.0_amd64.deb <https://sourceforge.net/projects/gazeparser/files/SimpleGazeTracker/0.12.0/simplegazetracker-spinnaker_0.12.0_amd64.deb>`_ (Spinnaker edition)
    For Spinnaker cameras. Spinnaker software must be installed to the recording PC.

- `SimpleGazeTracker-0.12.0-vs2019.zip <https://sourceforge.net/projects/gazeparser/files/SimpleGazeTracker/0.12.0/SimpleGazeTracker-0.12.0-vs2019.zip/download>`_
    Source codes.

.. _build_simplegazetracker_linux:

Build SimpleGazeTracker (Ubuntu 18.04 LTS)
-----------------------------------------------

OpenCV and SDL are necessary to build SimpleGazeTracker.
Install following packages in advance.
Other packages may be necessary depending on your environment.

- automake
- libopencv-dev
- libsdl2-dev
- libsdl2-net-dev
- libsdl2-ttf-dev
- libusb-1.0.0-dev

.. code-block:: bash

    ~$ sudo apt-get install libopencv-dev

Expand gzipped tarball and change working directory to the created directory.  Generate 'configure' script using autoconfig automake.

.. code-block:: bash

    ~/SimpleGazeTracker-x.x.x$ aclocal
    ~/SimpleGazeTracker-x.x.x$ autoheader
    ~/SimpleGazeTracker-x.x.x$ autoconf
    ~/SimpleGazeTracker-x.x.x$ automake --add-missing

Execute 'configure' script.  If error message is displayed, check missing files and install corresponding packages.
Ubuntu package search (`<http://packages.ubuntu.com/>`) is useful to search contents of packages.

.. code-block:: bash

    ~/SimpleGazeTracker-x.x.x$ ./configure

If 'configure' script finish successfully, build and install SimpleGazeTracker.

.. code-block:: bash

    ~/SimpleGazeTracker-x.x.x$ make
    ~/SimpleGazeTracker-x.x.x$ sudo make install

By default, simplegazetracker is installed at /usr/local/simplegazetracker.
Type as following to comfirm SimpleGazeTracker has been correctly installed.
If it works correctly, ~/SimpleGazeTracker directory is created at the home directory.
SimpleGazeTracker will show error message and terminate automatically if you have not connected camera unit in advance.

.. code-block:: bash

    ~/SimpleGazeTracker-x.x.x$ /usr/local/simplegazetracker/sgtsrv

Build SimpleGazeTracker Flycapture2 edition
-----------------------------------------------

Install Flycapture2 SDK in advance.
Procedure of building FlyCapture2 edition is the same as that of OpenCV edition except running configure script with --with-flycapture.

.. code-block:: bash

    ~/SimpleGazeTracker-x.x.x$ ./configure --with-flycapture

Name of the executable file of Flycapture2 edition is *sgtsrv-flycap*, not sgtsrv.


Build SimpleGazeTracker Spinnaker edition
-----------------------------------------------

Install Spinnaker SDK in advance.
Procedure of building Spinnaker edition is the same as that of OpenCV edition except running configure script with --with-spinnaker.

.. code-block:: bash

    ~/SimpleGazeTracker-x.x.x$ ./configure --with-spinnaker

Name of the executable file of Spinnaker edition is *sgtsrv-spinnaker*.