Ejemplo n.º 1
0
        public Task StartCalibrationAsync()
        {
            _calibration.Value.Clear();

            _recording.Disposable = GazeSource.Subscribe();

            return(Task.FromResult(true));
        }
Ejemplo n.º 2
0
 public static Vector2 GetEyePosition(Camera sceneCamera, GazeSource gazeSource)
 {
     if (_sceneCamera == null || _sceneCamera != sceneCamera)
     {
         _sceneCamera = sceneCamera;
         InitializeFrustumEyeOffset();
     }
     return(ApplyFrustumOffset(GetEyeGaze(gazeSource), gazeSource));
 }
Ejemplo n.º 3
0
    public static double Confidence(GazeSource s)
    {
        switch (s)
        {
        case GazeSource.RightEye:
            return(Confidence(PupilSettings.rightEyeID));

        default:
            return(Confidence(PupilSettings.leftEyeID));
        }
    }
Ejemplo n.º 4
0
 public Vector2 GetEyeGaze(GazeSource s)
 {
     if (s == GazeSource.RightEye)
     {
         return(RightEyePos);
     }
     if (s == GazeSource.LeftEye)
     {
         return(LeftEyePos);
     }
     return(NormalizedEyePos);
 }
Ejemplo n.º 5
0
		public MainWindow()
		{
			InitializeComponent();
			GazeSource = GazeSourceFactory.Create();
			GazeSource.UseCalibration = true;
			GazeSource.UseSmoothing = true;
			GazeSource.DataAvailable += GazeSource_DataAvailable;
			Timer = new DispatcherTimer();
			Timer.Interval = GazeTimeMilliseconds;
			Timer.IsEnabled = false;
			Timer.Tick += Timer_Tick;
		}
Ejemplo n.º 6
0
 public Vector3 GetEyeGaze(GazeSource s)
 {
     if (s == GazeSource.RightEye)
     {
         return(RightEyePos);
     }
     if (s == GazeSource.LeftEye)
     {
         return(LeftEyePos);
     }
     //take timestamp from right eye when using NormalizedEyePos, as left eye tracker is currently defective
     return(new Vector3(NormalizedEyePos.x, NormalizedEyePos.y, RightEyePos.z));
 }
Ejemplo n.º 7
0
        public static Vector2 GetEyeGaze(GazeSource s)
        {
            switch (s)
            {
            case GazeSource.LeftEye:
                return(LeftEyePos);

            case GazeSource.RightEye:
                return(RightEyePos);

            default:
                return(GazePosition);
            }
        }
 public Vector2 GetEyeGaze(GazeSource s)
 {
     if (s == GazeSource.RightEye)
     {
         return(rightEye.gaze);
     }
     else if (s == GazeSource.LeftEye)
     {
         return(leftEye.gaze);
     }
     else
     {
         return(centerEye);
     }
 }
Ejemplo n.º 9
0
        public async Task AddCalibrationPointAsync(Point2 point)
        {
            List <CalibrationPointResult> calibration = _calibration.Value;

            var gazePoints = await GazeSource.Take(10).ToList();

            calibration.Add(new CalibrationPointResult
                            (
                                point,
                                gazePoints.Select(p => new CalibrationSample
                                                  (
                                                      new CalibrationEyeSample(p.LeftEye.GazePoint2D, CalibrationSampleStatus.ValidAndUsedInCalibration),
                                                      new CalibrationEyeSample(p.RightEye.GazePoint2D, CalibrationSampleStatus.ValidAndUsedInCalibration)
                                                  ))
                            ));
        }
Ejemplo n.º 10
0
    public static void UpdateCurrentEyeID(string id)
    {
        switch (id)
        {
        case stringForLeftEyeID:
            currentEyeID = GazeSource.LeftEye;
            break;

        case stringForRightEyeID:
            currentEyeID = GazeSource.RightEye;
            break;

        default:
            currentEyeID = GazeSource.GazeOnly;
            break;
        }
    }
Ejemplo n.º 11
0
        public static Vector2 ApplyFrustumOffset(Vector2 position, GazeSource gazeSource)
        {
            Vector2 offsetPoint = position;

            switch (gazeSource)
            {
            case GazeSource.LeftEye:
                offsetPoint -= (frustumOffsetsLeftEye - standardFrustumCenter);
                break;

            case GazeSource.RightEye:
                offsetPoint -= (frustumOffsetsRightEye - standardFrustumCenter);
                break;

            default:
                break;
            }
            return(offsetPoint);
        }
Ejemplo n.º 12
0
 private void StartCalibration()
 {
     System.Windows.Forms.Cursor.Hide();
     DataPointIndex            = 0;
     DataPoints                = new List <System.Drawing.Point>();
     GazeSource                = GazeSourceFactory.Create();
     GazeSource.UseCalibration = false;
     GazeSource.UseSmoothing   = true;
     GazeTimer          = new DispatcherTimer();
     GazeTimer.Interval = TimeSpan.FromMilliseconds(1000 / 50);
     GazeTimer.Tick    += GazeTimerTick;
     GazeTimer.Start();
     TimeoutTimer          = new DispatcherTimer();
     TimeoutTimer.Interval = TimeSpan.FromSeconds(8);
     TimeoutTimer.Tick    += TimeoutTimer_Tick;
     TimeoutTimer.Start();
     ClearFocusPointLocation();
     Canvas.SetLeft(FocusPoint, 0);
     Canvas.SetTop(FocusPoint, 0);
 }
Ejemplo n.º 13
0
 public void StartTracking()
 {
     _recording.Disposable = GazeSource.Subscribe(gz => GazeDataReceived?.Invoke(this, gz));
 }