public void OnGazeUpdate(GazeData gazeData) { if (Dispatcher.CheckAccess() == false) { Dispatcher.BeginInvoke(new Action(() => OnGazeUpdate(gazeData))); return; } // Start or stop tracking lost animation if ((gazeData.State & GazeData.STATE_TRACKING_GAZE) == 0 && (gazeData.State & GazeData.STATE_TRACKING_PRESENCE) == 0) return; //Tracking coordinates var d = Utility.Instance.ScaleDpi; var x = Utility.Instance.RecordingPosition.X; var y = Utility.Instance.RecordingPosition.Y; //var gX = gazeData.RawCoordinates.X; //var gY = gazeData.RawCoordinates.Y; var gX = gazeData.SmoothedCoordinates.X; var gY = gazeData.SmoothedCoordinates.Y; Left = d*x + d*gX - Width/2; Top = d*y + d*gY - Height/2; }
} //end function //IGazeListener onGazeUpdate used to receive tracking data //called each time new gaze data is sampled public void OnGazeUpdate(GazeData theData) { //update the latest gaze data gazeValidator.UpdateData(theData); //get data for eyes //for positioning based on eye/head position Eye eyeL = gazeValidator.getPrevEyeL(); Eye eyeR = gazeValidator.getPrevEyeR(); //get center point for eyes if (eyeL != null && eyeR != null) { double eyeX = Math.Min(eyeL.PupilCenterCoordinates.X, eyeR.PupilCenterCoordinates.X) + (Math.Abs((eyeR.PupilCenterCoordinates.X - eyeL.PupilCenterCoordinates.X)) / 2); double eyeY = Math.Min(eyeL.PupilCenterCoordinates.Y, eyeR.PupilCenterCoordinates.Y) + (Math.Abs((eyeR.PupilCenterCoordinates.Y - eyeL.PupilCenterCoordinates.Y)) / 2); eyeCoords = new Point2D(eyeX, eyeY); } //smoothed gaze data //for positioning based on gaze point Point2D prevSmoothCoords = gazeValidator.getPrevSmoothCoords(); if (prevSmoothCoords != null) { gazeCoords = gazeValidator.getPrevSmoothCoords(); } //print data //UnityEngine.Debug.Log("Avg Smooth Coordinates: (" + xAvgSmooth + ", " + yAvgSmooth + ")"); } //end function
/// <summary> /// Find average pupil center of two eyes. /// </summary> /// <param name="gazeData"/>gaze data frame to base calculation upon</param> /// <returns>the average center point in normalized values</returns> public static Point2D getEyesCenterNormalized(GazeData gazeData) { if (null != gazeData) return getEyesCenterNormalized(gazeData.LeftEye, gazeData.RightEye); else return null; }
public void OnGazeUpdate(GazeData gazeData) { int x = Mathf.RoundToInt((float)gazeData.SmoothedCoordinates.X); int y = Mathf.RoundToInt((float)gazeData.SmoothedCoordinates.Y); if (x == 0 & y == 0) { lastGazePoint = new Vector3((float)x,(float)y,0f); } else { lastGazeData = gazeData; lastGazePoint = new Vector3((float)x,(float)y,1f); double avgPupilSize = 0.0; if (gazeData.LeftEye != null) { avgPupilSize += gazeData.LeftEye.PupilSize; if (gazeData.RightEye != null) { avgPupilSize += gazeData.RightEye.PupilSize; avgPupilSize /= 2.0; } } LastPupilSize = (float)avgPupilSize; LastFixated = gazeData.IsFixated; } }
public void OnGazeUpdate(GazeData gazeData) { //Add frame to GazeData cache handler GazeDataValidator.Instance.Update(gazeData); _trackerTime = gazeData.TimeStampString; Debug.Log(gazeData); }
public void OnGazeUpdate(GazeData gazeData) { var x = (int)Math.Round(gazeData.SmoothedCoordinates.X, 0); var y = (int)Math.Round(gazeData.SmoothedCoordinates.Y, 0); if (x == 0 & y == 0) return; // Invoke thread Dispatcher.BeginInvoke(new Action(() => UpdateUI(x, y))); }
public void OnGazeUpdate(GazeData gazeData) { //Handle on main UI thread QueueCallback(new Callback(delegate { Invoke("PositionWayPoint", 0); })); }
private void Set(GazeData other) { State = other.State; TimeStamp = other.TimeStamp; RawCoordinates = other.RawCoordinates; SmoothedCoordinates = other.SmoothedCoordinates; LeftEye = other.LeftEye; RightEye = other.RightEye; IsFixated = other.IsFixated; }
private void Set(GazeData other) { State = other.State; TimeStamp = other.TimeStamp; TimeStampString = other.TimeStampString; RawCoordinates = new Point2D(other.RawCoordinates); SmoothedCoordinates = new Point2D(other.SmoothedCoordinates); LeftEye = new Eye(other.LeftEye); RightEye = new Eye(other.RightEye); IsFixated = other.IsFixated; }
public void OnGazeUpdate(GazeData gazeData) { //Console.WriteLine(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss.fff", // CultureInfo.InvariantCulture)); double gX = gazeData.SmoothedCoordinates.X; double gY = gazeData.SmoothedCoordinates.Y; Console.WriteLine("ET Gaze points: " + gX + "," + gY); //getting the distance in pixel distance = GazeUtils.getDistancePoint2D(gazeData.LeftEye.SmoothedCoordinates, gazeData.RightEye.SmoothedCoordinates); Lx = gazeData.LeftEye.SmoothedCoordinates.X;// *0.26328125; // 0.4013671875; //correction for mm Rx = gazeData.RightEye.SmoothedCoordinates.X;// *0.26328125; // 0.4013671875; // correction for mm }
public GazeData(GazeData other) { if (null != other) { State = other.State; TimeStamp = other.TimeStamp; RawCoordinates = other.RawCoordinates.Clone(); SmoothedCoordinates = other.SmoothedCoordinates.Clone(); LeftEye = other.LeftEye.Clone(); RightEye = other.RightEye.Clone(); IsFixated = other.IsFixated; } }
public GazeData(GazeData other) { if (null != other) { State = other.State; TimeStamp = other.TimeStamp; TimeStampString = other.TimeStampString; RawCoordinates = new Point2D(other.RawCoordinates); SmoothedCoordinates = new Point2D(other.SmoothedCoordinates); LeftEye = new Eye(other.LeftEye); RightEye = new Eye(other.RightEye); IsFixated = other.IsFixated; } }
public void OnGazeUpdate(GazeData gazeData) { if (!Enabled) return; // start or stop tracking lost animation if ((gazeData.State & GazeData.STATE_TRACKING_GAZE) == 0 && (gazeData.State & GazeData.STATE_TRACKING_PRESENCE) == 0) return; // tracking coordinates var x = ActiveScreen.Bounds.X; var y = ActiveScreen.Bounds.Y; var gX = Smooth ? gazeData.SmoothedCoordinates.X : gazeData.RawCoordinates.X; var gY = Smooth ? gazeData.SmoothedCoordinates.Y : gazeData.RawCoordinates.Y; var screenX = (int)Math.Round(x + gX, 0); var screenY = (int)Math.Round(y + gY, 0); // return in case of 0,0 if (screenX == 0 && screenY == 0) return; NativeMethods.SetCursorPos(screenX, screenY); }
public void OnGazeUpdate(GazeData gazeData) { ProcessSample(gazeData); AnalyzeSamples(); }
public void OnGazeUpdate(GazeData gazeData) { //Add frame to GazeData cache handler GazeDataValidator.Instance.Update(gazeData); //Debug.Log("Eye~GazeDataType: " + gazeData.TimeStampString); }
public void OnGazeUpdate(GazeData gazeData) { //Add frame to GazeData cache handler gazeUtils.Update(gazeData); }
/// <summary> /// Calculates distance between pupil centers based on previously /// recorded min and max values /// </summary> /// <param name="gazeData"/>gaze data frame to base calculation upon</param> /// <returns>a normalized value [0..1]</returns> public static double getEyesDistanceNormalized(GazeData gazeData) { return getEyesDistanceNormalized(gazeData.LeftEye, gazeData.RightEye); }
public void OnGazeUpdate(GazeData gazeData) { //Debug.Log ("entreeee"); //Add frame to GazeData cache handler GazeDataValidator.Instance.Update(gazeData); }
// Implementing IGazeListener public void OnGazeUpdate(GazeData gazeData) { //Add frame to GazeData cache handler if (gazeData.State == 7) _gd.Add(gazeData); }
private void ProcessSample(GazeData gazeData) { var right = PointF.Empty; var left = PointF.Empty; if ((gazeData.State & GazeData.STATE_TRACKING_EYES) != 0 || (gazeData.State & GazeData.STATE_TRACKING_PRESENCE) != 0) { if (!Equals(gazeData.LeftEye.PupilCenterCoordinates.X, 0.0) && !Equals(gazeData.LeftEye.PupilCenterCoordinates.Y, 0.0)) { left.X = (float)gazeData.LeftEye.PupilCenterCoordinates.X; left.Y = (float)gazeData.LeftEye.PupilCenterCoordinates.Y; } if (!Equals(gazeData.RightEye.PupilCenterCoordinates.X, 0.0) && !Equals(gazeData.RightEye.PupilCenterCoordinates.Y, 0.0)) { right.X = (float)gazeData.RightEye.PupilCenterCoordinates.X; right.Y = (float)gazeData.RightEye.PupilCenterCoordinates.Y; } } // create a new trackbox sample and enqueue it currentTrackboxObj = new TrackBoxObject { Left = left, Right = right, LeftValidity = left != PointF.Empty ? EyeCount.One : EyeCount.Zero, RightValidity = right != PointF.Empty ? EyeCount.One : EyeCount.Zero }; while (trackBoxHistory.Count > queueSize) trackBoxHistory.Dequeue(); trackBoxHistory.Enqueue(currentTrackboxObj); }
public void OnGazeUpdate(GazeData gazeData) { //Add frame to GazeData cache handler GazeDataValidator.Instance.Update(gazeData); }
/// <summary> /// Find average pupil center of two eyes. /// </summary> /// <param name="gazeData"/>gaze data frame to base calculation upon</param> /// <returns>the average center point in pixels</returns> public static Point2D getEyesCenterPixels(GazeData gazeData, int screenWidth, int screenHeight) { if (null != gazeData) return getEyesCenterPixels(gazeData.LeftEye, gazeData.RightEye, screenWidth, screenHeight); else return null; }
public void OnGazeUpdate(GazeData gazeData) { double gX = gazeData.SmoothedCoordinates.X; double gY = gazeData.SmoothedCoordinates.Y; gazes.Add(new Gaze(gX, gY, gazeData.TimeStamp)); }
public void OnGazeUpdate(GazeData gazeData) { gazeUtils.Update (gazeData); }
private void ProcessSample(GazeData gazeData) { var right = PointF.Empty; var left = PointF.Empty; if ((gazeData.State & GazeData.STATE_TRACKING_EYES) != 0 || (gazeData.State & GazeData.STATE_TRACKING_PRESENCE) != 0) { if (gazeData.LeftEye.PupilCenterCoordinates.X != 0 && gazeData.LeftEye.PupilCenterCoordinates.Y != 0) { left.X = (float)gazeData.LeftEye.PupilCenterCoordinates.X; left.Y = (float)gazeData.LeftEye.PupilCenterCoordinates.Y; } if (gazeData.RightEye.PupilCenterCoordinates.X != 0 && gazeData.RightEye.PupilCenterCoordinates.Y != 0) { right.X = (float)gazeData.RightEye.PupilCenterCoordinates.X; right.Y = (float)gazeData.RightEye.PupilCenterCoordinates.Y; } } // create a new trackbox sample and enqueue it CurrentTrackboxObj = new TrackBoxObject { Left = left, Right = right, LeftValidity = left != PointF.Empty ? EyeCount.One : EyeCount.Zero, RightValidity = right != PointF.Empty ? EyeCount.One : EyeCount.Zero }; EnqueueTrackBoxObject(CurrentTrackboxObj); }
public void OnGazeUpdate(GazeData gazeData) { OnGazeChanged(new GazeEventArgs() { LeftX = (float)gazeData.LeftEye.SmoothedCoordinates.X, LeftY = UnityEngine.Screen.height - (float)gazeData.LeftEye.SmoothedCoordinates.Y, LeftPupilDiameter = (float)gazeData.LeftEye.PupilSize, RightX = (float)gazeData.RightEye.SmoothedCoordinates.X, RightY = UnityEngine.Screen.height - (float)gazeData.RightEye.SmoothedCoordinates.Y, RightPupilDiameter = (float)gazeData.RightEye.PupilSize }); }
public void OnGazeUpdate(GazeData data) { if (GazeManager.Instance.IsCalibrated && pointEvent != null) { pointEvent(this, new Timestamped<Point>( new Point(data.SmoothedCoordinates.X, data.SmoothedCoordinates.Y), new DateTimeOffset(DateTime.Parse(data.TimeStampString)).ToUniversalTime())); } }