Ejemplo n.º 1
0
        /// <summary>
        /// Is called whenever new raw data is available,
        /// sends the <see cref="GTExtendedDataChanged"/> event.
        /// </summary>
        /// <param name="data">The gaze data.</param>
        private void OnGTExtendedDataChanged(GTExtendedData data)
        {
            this.lastTime = data.TimeStamp;

            if (this.GTExtendedDataChanged != null)
            {
                this.GTExtendedDataChanged(data);
            }
        }
Ejemplo n.º 2
0
        private Tracker(GTCommands commands)
        {
            log.Info("Constructing Tracker...");
            this.commands       = commands;
            detectionManager    = new DetectionManager();
            calibration         = new Calibration.Calibration();
            recalibration       = new Recalibration();
            eyeMovement         = new Classifier();
            exponentialSmoother = new ExponentialSmoother(Settings.Instance.EyeMovement.SmoothNumberOfSamples, 0, (int)Math.Ceiling(Settings.Instance.EyeMovement.SmoothLevel / 5.0));
            visualization       = new Visualization();
            server                         = new UDPServer();
            gazeDataRaw                    = new GTGazeData();
            gazeDataSmoothed               = new GTGazeData();
            gazeDazaExtended               = new GTExtendedData();
            processingDone                 = true;
            timerCalibrationDelay          = new DispatcherTimer();
            timerCalibrationDelay.Interval = TimeSpan.FromMilliseconds(calibrationDelayMilliseconds);
            timerCalibrationDelay.Tick    += TimerCalibrationTick;
            logGaze                        = new Logger();
            logGaze.Server                 = server; // Used to send messages back to client (log start/stop etc.)
            log.Info("Looking up LoggingEnabled in FileSettings");
            logGaze.IsEnabled = Settings.Instance.FileSettings.LoggingEnabled;

            log.Info("Setting RecalibrationAvailableHandler");
            recalibration.RecalibrationAvailable += new Recalibration.RecalibrationAvailableHandler(recalibration_RecalibrationAvailable);
            //recalibration.OnRecalibrationAvailable +=new Recalibration.RecalibrationAvailable(recalibration_OnRecalibrationAvailable);
            Settings.Instance.Processing.PropertyChanged += ProcessingSettingsPropertyChanged;
            timerCalibrationDelay.Tick += TimerCalibrationTick;

            if (GTHardware.Camera.Instance.Device != null)
            {
                log.Info("Setting GTHardware device OnImage EventHandler");
                GTHardware.Camera.Instance.Device.OnImage += new EventHandler <GTHardware.Cameras.ImageEventArgs>(Device_OnImage);
            }
            string sDate = DateTime.Now.ToString();

            sDate = sDate.Replace(" ", "");
            sDate = sDate.Replace("/", "");
            sDate = sDate.Replace(":", "");

            log.Info("Completed constructing Tracker");

            fileName2 = "c:\\temp\\log" + sDate + ".csv";
            appendToFile(fileName2, "TimeStamp;GazeX;GazeY;DiameterLeftPupil;DiameterRightPupil");

            /*fileName = "c:\\temp\\log" + sDate + ".arff";
             * appendToFile(fileName, "@relation 'logeye'");
             * appendToFile(fileName, "@attribute TimeStamp real");
             * appendToFile(fileName, "@attribute GazeX real");
             * appendToFile(fileName, "@attribute GazeY real");
             * appendToFile(fileName, "@attribute DiameterLeftPupil real");
             * appendToFile(fileName, "@attribute DiameterRightPupil real");
             * appendToFile(fileName, "@data");*/
        }
Ejemplo n.º 3
0
        /// <summary>
        /// The <see cref="GTExtendedData"/> event handler
        /// which is called whenever there is a new frame arrived.
        /// Sends the GazeDataChanged event to the recording module.
        /// </summary>
        /// <param name="data">The tracking data with the mapped gaze
        /// coordinates in pixel units.</param>
        private void OnGTExtendedDataChanged(GTExtendedData data)
        {
            var gazeData = new GazeData
            {
                Time      = data.TimeStamp,
                PupilDiaX = (float)data.PupilDiameterLeft,
                PupilDiaY = (float)data.PupilDiameterRight,

                // Calculate values between 0..1
                GazePosX = (float)(data.GazePositionX / this.presentationScreenSize.Width),
                GazePosY = (float)(data.GazePositionY / this.presentationScreenSize.Height)
            };

            this.OnGazeDataChanged(new GazeDataChangedEventArgs(gazeData));
        }
Ejemplo n.º 4
0
        private Tracker(GTCommands commands)
        {
            log.Info("Constructing Tracker...");
            this.commands       = commands;
            detectionManager    = new DetectionManager();
            calibration         = new Calibration.Calibration();
            recalibration       = new Recalibration();
            eyeMovement         = new Classifier();
            exponentialSmoother = new ExponentialSmoother(Settings.Instance.EyeMovement.SmoothNumberOfSamples, 0, (int)Math.Ceiling(Settings.Instance.EyeMovement.SmoothLevel / 5.0));
            visualization       = new Visualization();
            server                         = new UDPServer();
            gazeDataRaw                    = new GTGazeData();
            gazeDataSmoothed               = new GTGazeData();
            gazeDazaExtended               = new GTExtendedData();
            processingDone                 = true;
            timerCalibrationDelay          = new DispatcherTimer();
            timerCalibrationDelay.Interval = TimeSpan.FromMilliseconds(calibrationDelayMilliseconds);
            timerCalibrationDelay.Tick    += TimerCalibrationTick;
            logGaze                        = new Logger();
            logGaze.Server                 = server; // Used to send messages back to client (log start/stop etc.)
            log.Info("Looking up LoggingEnabled in FileSettings");
            logGaze.IsEnabled = Settings.Instance.FileSettings.LoggingEnabled;

            log.Info("Setting RecalibrationAvailableHandler");
            recalibration.RecalibrationAvailable += new Recalibration.RecalibrationAvailableHandler(recalibration_RecalibrationAvailable);
            //recalibration.OnRecalibrationAvailable +=new Recalibration.RecalibrationAvailable(recalibration_OnRecalibrationAvailable);
            Settings.Instance.Processing.PropertyChanged += ProcessingSettingsPropertyChanged;
            timerCalibrationDelay.Tick += TimerCalibrationTick;

            if (GTHardware.Camera.Instance.Device != null)
            {
                log.Info("Setting GTHardware device OnImage EventHandler");
                GTHardware.Camera.Instance.Device.OnImage += new EventHandler <GTHardware.Cameras.ImageEventArgs>(Device_OnImage);
            }

            log.Info("Completed constructing Tracker");
        }