예제 #1
0
 private bool noEncontroOjos(Tobii.Gaze.Core.TrackingStatus dataStatus)
 {
     if (dataStatus == Tobii.Gaze.Core.TrackingStatus.NoEyesTracked)
         return true;
     else
         return false;
 }
예제 #2
0
        public void dataReceived(Tobii.Gaze.Core.TrackingStatus dataStatus)
        {
            if (noEncontroOjos(dataStatus))
                numberOfNoEyesTrackedMasMas();
            else
                numberOfNoEyesTrackedMenosMenos();

            checkNumberOfNoEyesTrackedReceived();// si es valor maximo bandera true, si es valor minimo bandera false
        }
        public void SetPlotData(Tobii.Gaze.Core.Calibration calibration)
        {
            _leftPlot.Initialize(calibration.GetCalibrationPointDataItems());
            _rightPlot.Initialize(calibration.GetCalibrationPointDataItems());

            if (datosCompartidos.meanCalibrationErrorLeftPx == -2147483648)
                textBoxCalibrationErrorLeft.Text = "No calibrado";
            else
                textBoxCalibrationErrorLeft.Text = datosCompartidos.meanCalibrationErrorLeftPx.ToString();

            if (LookAndPlayForm.Program.datosCompartidos.meanCalibrationErrorRightPx == -2147483648)
                textBoxCalibrationErrorRight.Text = "No calibrado";
            else
                textBoxCalibrationErrorRight.Text = datosCompartidos.meanCalibrationErrorRightPx.ToString();
        }
예제 #4
0
        public static int distanceBetweenDev2User(Tobii.Gaze.Core.GazeData SoruceGazeData)
        {
            double distanceDev2User = (SoruceGazeData.Left.EyePositionInTrackBoxNormalized.Z + SoruceGazeData.Right.EyePositionInTrackBoxNormalized.Z) * 0.5 * 100;
            int returnValue = Convert.ToInt32(distanceDev2User);

            if (returnValue > 100)
            {
                returnValue = 100;
            }
            else if (returnValue < 0)
            {
                returnValue = 0;
            }

            return returnValue;
        }
예제 #5
0
        private void OnGetCalibrationCompleted(Calibration calibration, Tobii.Gaze.Core.ErrorCode errorCode)
        {
            LookAndPlayForm.Program.datosCompartidos.calibrationDataEyeX = calibration;

            CalibrationError errorCalibracion = new CalibrationError(LookAndPlayForm.Program.datosCompartidos.calibrationDataEyeX.GetCalibrationPointDataItems());
            LookAndPlayForm.Program.datosCompartidos.meanCalibrationErrorLeftPx = errorCalibracion.meanCalibrationErrorLeftPx;
            LookAndPlayForm.Program.datosCompartidos.meanCalibrationErrorRightPx = errorCalibracion.meanCalibrationErrorRightPx;

            Console.WriteLine("EyetrackingEngine.OnGetCalibrationCompleted. errorCode: " + errorCode.ToString() +
                "error: " +
                errorCalibracion.meanCalibrationErrorLeftPx.ToString() + ", " +
                errorCalibracion.meanCalibrationErrorRightPx.ToString());

            if (OnGetCalibrationCompletedEvent != null)
                OnGetCalibrationCompletedEvent(this, new CalibrationReadyEventArgs(errorCalibracion.CalibrationPointDataL));
        }
예제 #6
0
 private void OnDeviceInfoCompleted(DeviceInfo deviceInfo, Tobii.Gaze.Core.ErrorCode errorCode)
 {
     LookAndPlayForm.Program.datosCompartidos.EyeTrackerInfo = deviceInfo.Model;
 }
예제 #7
0
 /// <summary>
 /// Internal method fired by the Tobii eventhandler.
 /// </summar>
 private void OnActivate(object sender, Tobii.TecSDK.Client.Interaction.ActivateEventArgs e)
 {
     Publish(this, EventType.ALTER);
 }
예제 #8
0
 public void SetPlotData(Tobii.EyeTracking.IO.Calibration calibration)
 {
     _leftPlot.Initialize(calibration.Plot);
     _rightPlot.Initialize(calibration.Plot);
 }
예제 #9
0
        public static PointD WeighGaze(Tobii.Gaze.Core.GazeData GazeData2Weigh)
        {
            PointD GazeWeighed = new PointD();
            double leftWeigh;
            double rightWeigh;
            double totalWeigh;

            switch (GazeData2Weigh.TrackingStatus)
            {
                //los dos ojos
                case TrackingStatus.BothEyesTracked:
                    leftWeigh = 1;
                    rightWeigh = 1;
                    totalWeigh = 0.5;
                    break;

                //left solo
                case TrackingStatus.OneEyeTrackedProbablyLeft:
                    leftWeigh = 1;
                    rightWeigh = 0;
                    totalWeigh = 1;
                    break;
                case TrackingStatus.OnlyLeftEyeTracked:
                    leftWeigh = 1;
                    rightWeigh = 0;
                    totalWeigh = 1;
                    break;

                //rigth solo
                case TrackingStatus.OneEyeTrackedProbablyRight:
                    leftWeigh = 0;
                    rightWeigh = 1;
                    totalWeigh = 1;
                    break;
                case TrackingStatus.OnlyRightEyeTracked:
                    leftWeigh = 0;
                    rightWeigh = 1;
                    totalWeigh = 1;
                    break;

                //peores casos
                case TrackingStatus.NoEyesTracked:
                    leftWeigh = Double.NaN;
                    rightWeigh = Double.NaN;
                    totalWeigh = Double.NaN;
                    break;
                case TrackingStatus.OneEyeTrackedUnknownWhich:
                    leftWeigh = Double.NaN;
                    rightWeigh = Double.NaN;
                    totalWeigh = Double.NaN;
                    break;

                default:
                    leftWeigh = Double.NaN;
                    rightWeigh = Double.NaN;
                    totalWeigh = Double.NaN;
                    break;
            }

            GazeWeighed.X = ((GazeData2Weigh.Left.GazePointOnDisplayNormalized.X) * leftWeigh + (GazeData2Weigh.Right.GazePointOnDisplayNormalized.X * rightWeigh)) * totalWeigh;
            GazeWeighed.Y = ((GazeData2Weigh.Left.GazePointOnDisplayNormalized.Y) * leftWeigh + (GazeData2Weigh.Right.GazePointOnDisplayNormalized.Y * rightWeigh)) * totalWeigh;

            return GazeWeighed;
        }
예제 #10
0
 private static Point3D ToWpfPoint3D(Tobii.Eyetracking.Sdk.Point3D pt, double scale)
 {
     double x = pt.X * scale;
     double y = pt.Y * scale;
     double z = pt.Z * scale;
     return new Point3D(x,y,z);
 }
예제 #11
0
        public void OnGazeData(Tobii.Gaze.Core.GazeData gd)
        {
            // Add data to history
            _dataHistory.Enqueue(gd);

            // Remove history item if necessary
            while (_dataHistory.Count > HistorySize)
            {
                _dataHistory.Dequeue();
            }

            //_leftValidity = gd.LeftValidity;
            //_rightValidity = gd.RightValidity;
            _eyesValidity = gd.TrackingStatus;

            //_leftEye = gd.LeftEyePosition3DRelative;
            //_rightEye = gd.RightEyePosition3DRelative;
            _leftEye = gd.Left.EyePositionInTrackBoxNormalized;
            _rightEye = gd.Right.EyePositionInTrackBoxNormalized;

            Invalidate();
        }
예제 #12
0
 private void GazeData(object sender, Tobii.Gaze.Core.GazeDataEventArgs e)
 {
     Dispatcher.BeginInvoke(
         System.Windows.Threading.DispatcherPriority.Normal, new Action(delegate() { ProcessData(e.GazeData); }));
 }
예제 #13
0
 private void EyeTrackerError(object sender, Tobii.Gaze.Core.EyeTrackerErrorEventArgs e)
 {
     Debug.WriteLine(e.ErrorCode);
 }
예제 #14
0
        private void ProcessData(Tobii.Gaze.Core.GazeData gazeData)
        {
            GazeDataProccessed gazeDataProccessed = new GazeDataProccessed(gazeData);

            if (gazeData.TrackingStatus == Tobii.Gaze.Core.TrackingStatus.BothEyesTracked)
            {
                this.angleAtDistance.Content = Decimal.Round((decimal) gazeDataProccessed.angleAtDistance, 1, MidpointRounding.AwayFromZero) + "° " + gazeDataProccessed.typeAtDistance;
                this.angleAtScreen.Content = Decimal.Round((decimal)gazeDataProccessed.angleAtScreen, 1, MidpointRounding.AwayFromZero) + "° " + gazeDataProccessed.typeAtScreen;
            }
        }
예제 #15
0
 public Vector3D(Tobii.Gaze.Core.Point3D point3D1, Tobii.Gaze.Core.Point3D point3D2)
 {
     this.x = point3D2.X - point3D1.X;
     this.y = point3D2.Y - point3D1.Y;
     this.z = point3D2.Z - point3D1.Z;
 }