05Robot 3.0

- Main Page
- Modules
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
cEyeTrackerFilter Class Reference
Eyetracker module

The cEyeTrackerFilter class. More...

`#include <ceyetrackerfilter.h>`

Inheritance diagram for cEyeTrackerFilter:

## Public Types

## Signals
void | complexGesture (int ID, QRect bb, QPoint point, QString name)
| Signal is send when complex gesture was recognized. More...
void | logEvent (cEyeTrackerFilter::logSource ID, int x, int y, int additional, QString info)

## Public Member Functions
void | Settangential_coefs (double _arg_tangential_coefs)
| Sets tangential_coefs property value. More...
double | tangential_coefs () const
| Gets tangential_coefs property value. More...
| Q_CLASSINFO ("tangential_coefs","minimum=0;maximum=.5;singleStep=0.05;")
void | Setuse_gaze2click (bool _arg_use_gaze2click)
| Sets use_gaze2click property value. More...
bool | use_gaze2click () const
| Gets use_gaze2click property value. More...
void | Setgaze_timeout (int _arg_gaze_timeout)
| Sets gaze_timeout property value. More...
int | gaze_timeout () const
| Gets gaze_timeout property value. More...
void | Setgaze_tolerance (int _arg_gaze_tolerance)
| Sets gaze_tolerance property value. More...
int | gaze_tolerance () const
| Gets gaze_tolerance property value. More...
void | Setminimum_gesture_segment_length_ratio (double _arg_minimum_gesture_segment_length_ratio)
| Sets minimum_gesture_segment_length_ratio property value. More...
double | minimum_gesture_segment_length_ratio () const
| Gets minimum_gesture_segment_length_ratio property value. More...
| Q_CLASSINFO ("minimum_gesture_segment_length_ratio","minimum=1;maximum=100;singleStep=0.1;")
void | Setuse_complex_gestures (bool _arg_use_complex_gestures)
| Sets use_complex_gestures property value. More...
bool | use_complex_gestures () const
| Gets use_complex_gestures property value. More...
void | Setleave_window_timeout (int _arg_leave_window_timeout)
| Sets leave_window_timeout property value. More...
int | leave_window_timeout () const
| Gets leave_window_timeout property value. More...
void | Setgesture_tolerance (int _arg_gesture_tolerance)
| Sets gesture_tolerance property value. More...
int | gesture_tolerance () const
| Gets gesture_tolerance property value. More...
| cEyeTrackerFilter (const QVector< cGestureDirectoryEntry > &gDirectory, QWidget *mouseGrabberWidget, int xmlID=0)
| The constructor for event filter class. More...
bool | eventFilter (QObject *watched, QEvent *event)
| the overridden eventFilter function used to process mouse events More...
Public Member Functions inherited from cXmlIO
| cXmlIO (int _xmlID=0, QObject *parent=nullptr)
virtual QString | sXmlKey ()
| Generates key of XML entry (as name of the serialised class is) More...
virtual void | findInXML (QString &fileName, bool compareXmlID=true)
| serches th file for XML key corr to class name and fill class properties according to entries found More...
virtual void | writeXml (QXmlStreamWriter &xml)
| Writes XML entries to file. Can be overloaded to save additional data, apart from object properties. More...
virtual void | readXml (QXmlStreamReader &xml)
| Called by findInXML. Reads XML entries. Has to be overloaded if additional data was written to file in object entry. More...
virtual void | writeCsvData (QXmlStreamWriter &stream, QString key, const QVector< QVector< double > > &s)
virtual void | writeCsvVector (QXmlStreamWriter &stream, QString key, const QVector< double > &s)
virtual void | readCsvData (QXmlStreamReader &stream, QVector< QVector< double > > &s)
virtual void | readCsvVector (QXmlStreamReader &stream, QVector< double > &s)
virtual void | write64BaseData (QXmlStreamWriter &stream, QString key, const QVector< QVector< double > > &s)
virtual void | read64BaseData (QXmlStreamReader &stream, QVector< QVector< double > > &s)
template<typename T >
void | writeData (QXmlStreamWriter &stream, QString key, const T &data)
template<typename T >
void | readData (QXmlStreamReader &stream, T &data)
int | getXmlID () const
void | setXmlID (int value)

## Protected Member Functions
sAtomGesture::eGestureType | detectGesture (sAtomGesture::eGestureType confirmType)
| Extracts atom and complex gestures. More...
sAtomGesture::eGestureType | detectComplexGesture ()
| process the detected atomic gestures and compare them with gesture directory More...
void | clearBuffers ()
| Clears the buffer of detected atomic gestures, and mouse trace. More...
void | addAtomGesture (const sAtomGesture &newGesture)
| Adds new atomic gestures to buffer of detected gestures. More...
boundingBoxInfo | boundingBox (int64_t timeHorizont=-1)
| Calculates statistics for mouse cursor trace represented by set of sMouse elements, stored in buffer. More...
sAtomGesture | atomGesturesClassifier (const boundingBoxInfo &info)
| Tries to classify the mouse cursor trace into one of atomic gestures. More...
Protected Member Functions inherited from cXmlIO
void | metaDataXmlReader (QXmlStreamReader &stream, QObject &obj, bool isUser=true)
void | metaDataXmlWriter (QXmlStreamWriter &stream, const QObject &obj, bool isUser=true)

## Properties
double | tangential_coefs
| The maximum tangental deviation from horizontal or vertical line. The value should be between 0 and 0.5 (0.5 means the 45deg angle) More...
bool | use_gaze2click
| If it is true watching at region of size gaze_tolerance for time longer than gaze_timeout will generate the left click event. More...
int | gaze_timeout
| The period in [ms] required to generate click event when user watch at certain point (use_gaze2click) More...
int | gaze_tolerance
| The size of bounding box used to detect gaze_event (use_gaze2click), the value is used also to detect horizontal and vertical line action. The line has to be longer than minimum_gesture_segment_length_ratio * gaze_tolerance. More...
double | minimum_gesture_segment_length_ratio
| The the minimum length of line segment detected as atomic gesture is calculated as minimum_gesture_segment_length_ratio * gaze_tolerance. More...
bool | use_complex_gestures
| Turn on/off the complex gestures detection. More...
int | leave_window_timeout
| The maximum duration when mouse cursor leaves the window to be ignored. If false the atomic gestures queue is wiped out. More...
int | gesture_tolerance
| The maximum tolerance (in px) used in complex gesture matching, passed to cGestureDirectoryEntry::compare function. More...
Properties inherited from cXmlIO
int | xmlID
| Defines uniqe identifier for object in XML file. More...

## Additional Inherited Members
Static Public Member Functions inherited from cXmlIO
static void | metaCopy (QObject *dest, QObject *src)

## Detailed Description

The cEyeTrackerFilter class.

## Member Enumeration Documentation

enum logSource

Enumerator
MOUSE_MOVE |
MOUSE_CLICK |
HOVER_LEAVE |
HOVER_ENTER |
ATOM_GESTURE_EVENT |
COMPLEX_GESTURE_EVENT |
CONFIRM_EVENT |
USER |

## Constructor & Destructor Documentation

cEyeTrackerFilter | ( | const QVector< cGestureDirectoryEntry > & | gDirectory,
|  | QWidget * | mouseGrabberWidget,
|  | int | xmlID = `0`
| ) |  |
| explicit

The constructor for event filter class.

Parameters

  gDirectory | - directory of complex gestures
  mouseGrabberWidget | - the main widget for which the mouse position is send by in QEvent::MouseMove to eventFilter function
  xmlID | - id for xml serializer

The filter can be added to any QObject or QApplication::instance()

cEyeTrackerFilter* eventFilter= new cEyeTrackerFilter(v,this,0);
qApp->installEventFilter(eventFilter);

## Member Function Documentation

void addAtomGesture | ( | const sAtomGesture & | newGesture | ) |
| protected

Adds new atomic gestures to buffer of detected gestures.

Parameters

  newGesture | Gesture to be added to set of atom gestures

If two following gestures are the same it will try to merge them, otherwise it adds the newElement as new gesture

sAtomGesture atomGesturesClassifier | ( | const boundingBoxInfo & | info | ) |
| protected

Tries to classify the mouse cursor trace into one of atomic gestures.

Parameters

  info | statistics of mouse trace calculated by boundingBox function

Returns
  If gesture was unambiguously detected it might return (sAtomGesture::H_LINE_LEFT,sAtomGesture::H_LINE_RIGHT, sAtomGesture::V_LINE_UP, sAtomGesture::V_LINE_DOWN, sAtomGesture::GAZE), when the gesture can not be unambiguously determined sAtomGesture::IN_PROGRESS is returned, if no gesture match sAtomGesture::OTHER is returned

boundingBoxInfo boundingBox | ( | int64_t | timeHorizont = `-1` | ) |
| protected

Calculates statistics for mouse cursor trace represented by set of sMouse elements, stored in buffer.

Parameters

  timeHorizont | Determines the time interval in (ms) for calculating statistics. If it is -1 the all data are used

Returns
  The structure of calculated statistics

Warning
  Should be run only when the mouse cursor trace buffer is not empty

void clearBuffers | ( |  | ) |
| protected

Clears the buffer of detected atomic gestures, and mouse trace.

void complexGesture | ( | int | ID,
|  | QRect | bb,
|  | QPoint | point,
|  | QString | name
| ) |  |
| signal

Signal is send when complex gesture was recognized.

Parameters

  ID | The gesture ID defined in cGestureDirectoryEntry
  bb | The complex gesture resulted bounding box of mouse cursor trace
  name | The complex gesture name defined in cGestureDirectoryEntry

sAtomGesture::eGestureType detectComplexGesture | ( |  | ) |
| protected

process the detected atomic gestures and compare them with gesture directory

Returns
  sAtomGesture::IN_PROGRESS, or sAtomGesture::COMPLEX_GESTURE_DETECTED when complex gesture was detected

The function use postEvent to send cComplexGestureEvent. It generates also QMouseEvent, QKeyEvent if gaze was detected or cGestureDirecotry requires this The function emits also complexGesture signal

sAtomGesture::eGestureType detectGesture | ( | sAtomGesture::eGestureType | confirmType | ) |
| protected

Extracts atom and complex gestures.

Parameters

  confirmType | If set to sAtomGesture::GENERIC_CLICK, force to finish pending atomic gesture and to call detectComplexGesture routine, then wipes out buffer of detected gestures. Otherwise the argument should be sAtomGesture::IN_PROGRESS, then finishing atomic gesture is not forced, and the buffer is not cleared if the complex gesture was not detected.

Returns
  If complex gesture was not detected it returns sAtomGesture::IN_PROGRESS, when gesture was detected it return sAtomGesture::COMPLEX_GESTURE_DETECTED

Firstly, it try to detect atomic gestures by calculating statistics for recorded mouse trace calling boundingBox function and than runs atomGesturesClassifier. Secondly, when at least two gestures were pushed into detected gestures buffer it runs find detectComplexGesture

See also
  detectComplexGesture()

bool eventFilter | ( | QObject * | watched,
|  | QEvent * | event
| ) |  |

the overridden eventFilter function used to process mouse events

Parameters

  watched | The object watched events
  event | Pointer to event to be processed

Returns
  true Discards event, false - accepts event

int gaze_timeout | ( |  | ) | const

Gets gaze_timeout property value.

int gaze_tolerance | ( |  | ) | const

Gets gaze_tolerance property value.

int gesture_tolerance | ( |  | ) | const

Gets gesture_tolerance property value.

int leave_window_timeout | ( |  | ) | const

Gets leave_window_timeout property value.

void logEvent | ( | cEyeTrackerFilter::logSource | ID,
|  | int | x,
|  | int | y,
|  | int | additional,
|  | QString | info
| ) |  |
| signal

double minimum_gesture_segment_length_ratio | ( |  | ) | const

Gets minimum_gesture_segment_length_ratio property value.

Q_CLASSINFO | ( | "tangential_coefs" |  | ) |

Q_CLASSINFO | ( | "minimum_gesture_segment_length_ratio" |  | ) |

void Setgaze_timeout | ( | int | _arg_gaze_timeout | ) |

Sets gaze_timeout property value.

void Setgaze_tolerance | ( | int | _arg_gaze_tolerance | ) |

Sets gaze_tolerance property value.

void Setgesture_tolerance | ( | int | _arg_gesture_tolerance | ) |

Sets gesture_tolerance property value.

void Setleave_window_timeout | ( | int | _arg_leave_window_timeout | ) |

Sets leave_window_timeout property value.

void Setminimum_gesture_segment_length_ratio | ( | double | _arg_minimum_gesture_segment_length_ratio | ) |

Sets minimum_gesture_segment_length_ratio property value.

void Settangential_coefs | ( | double | _arg_tangential_coefs | ) |

Sets tangential_coefs property value.

void Setuse_complex_gestures | ( | bool | _arg_use_complex_gestures | ) |

Sets use_complex_gestures property value.

void Setuse_gaze2click | ( | bool | _arg_use_gaze2click | ) |

Sets use_gaze2click property value.

double tangential_coefs | ( |  | ) | const

Gets tangential_coefs property value.

bool use_complex_gestures | ( |  | ) | const

Gets use_complex_gestures property value.

bool use_gaze2click | ( |  | ) | const

Gets use_gaze2click property value.

## Property Documentation

int gaze_timeout
| read write

The period in [ms] required to generate click event when user watch at certain point (use_gaze2click)

See also
  use_gaze2click

int gaze_tolerance
| read write

The size of bounding box used to detect gaze_event (use_gaze2click), the value is used also to detect horizontal and vertical line action. The line has to be longer than minimum_gesture_segment_length_ratio * gaze_tolerance.

See also
  use_gaze2click

int gesture_tolerance
| read write

The maximum tolerance (in px) used in complex gesture matching, passed to cGestureDirectoryEntry::compare function.

int leave_window_timeout
| read write

The maximum duration when mouse cursor leaves the window to be ignored. If false the atomic gestures queue is wiped out.

double minimum_gesture_segment_length_ratio
| read write

The the minimum length of line segment detected as atomic gesture is calculated as minimum_gesture_segment_length_ratio * gaze_tolerance.

double tangential_coefs
| read write

The maximum tangental deviation from horizontal or vertical line. The value should be between 0 and 0.5 (0.5 means the 45deg angle)

bool use_complex_gestures
| read write

Turn on/off the complex gestures detection.

bool use_gaze2click
| read write

If it is true watching at region of size gaze_tolerance for time longer than gaze_timeout will generate the left click event.

The documentation for this class was generated from the following file:

- eyetracker/ceyetrackerfilter.h