Home Forums Software Development Heavy Filtering of gaze data Reply To: Heavy Filtering of gaze data

#3059
Jenny [Tobii]
Participant

Hi Mark,

There is currently no heavy filtering version of the Gaze Point Data stream in the EyeX Engine API. If you want to create a smoothing filter yourself, my collegue Robert had the following suggestion in a separate topic:

One easy filter that is quite efficient is a weighted moving average filter, for example the exponentially decaying filter discussed in this StackOverflow thread. For further reading, this paper includes a good summary.

This is the smoothing algorithm we use to create the smoothed movement of the light in the flashlight sample scene in the EyeX SDK for Unity:

public float alpha = 0.3f;
 private Vector2 _historicPoint;
 private bool _hasHistoricPoint:t;
(...)
 private Vector2 Smoothify(Vector2 point)
{
	if (!_hasHistoricPoint)
	{
		_historicPoint = point;
		_hasHistoricPoint = true;
	}

	var smoothedPoint = new Vector2(point.x*alpha + _historicPoint.x*(1.0f - alpha),
		point.y*alpha + _historicPoint.y*(1.0f - alpha));

	_historicPoint = smoothedPoint;

	return smoothedPoint;
}