Exemple #1
0
        public Task StartCalibrationAsync()
        {
            _calibration.Value.Clear();

            _recording.Disposable = GazeSource.Subscribe();

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

        default:
            return(Confidence(PupilSettings.leftEyeID));
        }
    }
 public Vector2 GetEyeGaze(GazeSource s)
 {
     if (s == GazeSource.RightEye)
     {
         return(RightEyePos);
     }
     if (s == GazeSource.LeftEye)
     {
         return(LeftEyePos);
     }
     return(NormalizedEyePos);
 }
		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;
		}
Exemple #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));
 }
Exemple #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);
     }
 }
Exemple #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)
                                                  ))
                            ));
        }
Exemple #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;
        }
    }
Exemple #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);
        }
Exemple #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);
 }
Exemple #13
0
 public void StartTracking()
 {
     _recording.Disposable = GazeSource.Subscribe(gz => GazeDataReceived?.Invoke(this, gz));
 }