gaze
0.1.0
Perform gaze tracking with common webcams.
|
Implements an experiment flow for Judd et al. (2009) Judd2009. More...
#include "where_people_look/experiment.h"
Public Member Functions | |
Experiment (GtkImage *const image, Config *const config) | |
Config * | get_config () |
Experiment usage | |
void | prepare () |
void | start () |
You should not call this manually. | |
bool | trial () |
Static Public Member Functions | |
static gboolean | experiment_calibrate (gpointer experiment) |
static gboolean | experiment_trial (gpointer experiment) |
static gboolean | experiment_quit_program (gpointer experiment) |
static bool | experiment_prepare (const GtkWidget *const assistant, Experiment *const experiment) |
static bool | experiment_start (const GtkWidget *const window, const GdkEventKey *const event_key, Experiment *const experiment) |
Implements an experiment flow for Judd et al. (2009) Judd2009.
The data acquisition experiment can be prepared, started, quitted, and is divided into trials.
The experiment should first be prepared (prepare()), then started (start()). After that, it will go through each available trial, recalibrate every 50 trials, and stop after all trials are done.
Each trial lasts three seconds and there are pauses of one second between the trials, during which a gray screen is shown.
Before the first and after the last trial there is another two seconds break.
Definition at line 45 of file experiment.h.
wpl::Experiment::Experiment | ( | GtkImage *const | image, |
Config *const | config | ||
) |
Constructs an experiment.
image | The GtkImage* to be updated for each trial. |
config | The configuration. It is used to find the stimuli. |
Definition at line 48 of file experiment.cpp.
|
static |
Calibrates the GazeTracker of the specified experiment.
experiment | Must be a gpointer to an Experiment. |
Definition at line 104 of file experiment.cpp.
Referenced by trial().
|
static |
Calls prepare() on the given experiment.
assistant | This widget is ignored but needed to bind the G_CALLBACK properly. |
experiment | Must be a gpointer to an Experiment. |
Definition at line 123 of file experiment.cpp.
References prepare().
|
static |
Gets the ancestor window of the experiment's image (see Experiment(GtkImage*,Config*)) and issues a destroy
signal.
experiment | Must be a gpointer to an Experiment. |
Definition at line 111 of file experiment.cpp.
Referenced by trial().
|
static |
Calls start() on the given experiment if the space key is event_key's keyval and the experiment is not started.
window | This widget is ignored but needed to bind the G_CALLBACK properly. |
event_key | The event key to process. |
experiment | Must be a gpointer to an Experiment. |
Definition at line 129 of file experiment.cpp.
References start().
|
static |
Calls trial() on the given experiment.
experiment | Must be a gpointer to an Experiment. |
Definition at line 119 of file experiment.cpp.
References trial().
Referenced by start(), and trial().
Config * wpl::Experiment::get_config | ( | ) |
Definition at line 57 of file experiment.cpp.
void wpl::Experiment::prepare | ( | ) |
Prepares the experiment.
Preparations performed are
Definition at line 61 of file experiment.cpp.
References lock().
Referenced by experiment_prepare().
void wpl::Experiment::start | ( | ) |
Starts the experiment. After a warmup time, the first trial starts.
If this function is called on a started experiment, it simply returns.
Definition at line 71 of file experiment.cpp.
References experiment_trial(), and lock().
Referenced by experiment_start().
bool wpl::Experiment::trial | ( | ) |
Handles trials.
This function should not be called manually.
If a calibration is needed (because of the 50-trials-then-recalibrate setting), this calls the calibration function and polls itself every 500 millisecondss to try to continue the experiment with the next trial.
If a calibration is already (or still) in progress, this simply returns true
to trigger another test.
If there are no trials left, this issues a program quit after two seconds.
Only if no calibration needs to be done or is in progress, and there are still trials left, an actual trial is started: A stimulus is presented for three seconds, followed by a one second pause. This trial function issues a new trial to be performed afterwards and returns false
to not poll itself again.
Definition at line 80 of file experiment.cpp.
References experiment_calibrate(), experiment_quit_program(), experiment_trial(), and lock().
Referenced by experiment_trial().