示例#1
0
 private void gazePointNext(object sender, GazePointEventArgs e)
 {
     if (gazePointListener != null)
     {
         gazePointListener.receiveGazePoint(e.X, e.Y);
     }
 }
示例#2
0
        private void GazePoint(object sender, GazePointEventArgs e)
        {
            var p = new Point(e.X, e.Y);

            if (p != _gazePoint)
            {
                Invalidate(new Rectangle
                {
                    X      = _gazePoint.X - _radius,
                    Y      = _gazePoint.Y - _radius,
                    Width  = _diameter,
                    Height = _diameter
                });

                _gazePoint = p;
                Invalidate(new Rectangle
                {
                    X      = _gazePoint.X - _radius,
                    Y      = _gazePoint.Y - _radius,
                    Width  = _diameter,
                    Height = _diameter
                }
                           );
            }
        }
示例#3
0
 private void GazeDataStream_Next(object sender, GazePointEventArgs e)
 {
     lock (gaze)
         gaze = new GazePointEventArgs(e.X, e.Y, e.Timestamp);
     lock (stableGaze)
         stableGaze.Add(new GazePointEventArgs(e.X, e.Y, e.Timestamp));
 }
示例#4
0
 private void RecordGazePoint(object s, GazePointEventArgs e)
 {
     if (isGazePointDataRecording)
     {
         gazePoints.Enqueue(new GazePointEventArgs(e.X, e.Y, e.Timestamp));
     }
 }
示例#5
0
        private void NewGazePoint(object sender, GazePointEventArgs gazePointEventArgs)
        {
            const double screenExtensionFactor = 0;
            var          screenExtensionX      = _host.ScreenBounds.Value.Width * screenExtensionFactor;
            var          screenExtensionY      = _host.ScreenBounds.Value.Height * screenExtensionFactor;

            var gazePointX = gazePointEventArgs.X + screenExtensionX / 2;
            var gazePointY = gazePointEventArgs.Y + screenExtensionY / 2;

            var screenWidth  = _host.ScreenBounds.Value.Width + screenExtensionX;
            var screenHeight = _host.ScreenBounds.Value.Height + screenExtensionY;

            if (screenHeight > 0)
            {
                _aspectRatio = screenWidth / screenHeight;
            }

            var normalizedGazePointX = (float)Math.Min(Math.Max((gazePointX / screenWidth), 0.0), 1.0);
            var normalizedGazePointY = (float)Math.Min(Math.Max((gazePointY / screenHeight), 0.0), 1.0);

            var normalizedCenterDeltaX = (normalizedGazePointX - 0.5f) * 2.0f;
            var normalizedCenterDeltaY = (normalizedGazePointY - 0.5f) * 2.0f;

            if (float.IsNaN(normalizedCenterDeltaX) || float.IsNaN(normalizedCenterDeltaY))
            {
                return;
            }

            _lastNormalizedCenterDelta = new Vector2(normalizedCenterDeltaX, normalizedCenterDeltaY);
            _gazeVisualization.MovePoint(_lastNormalizedCenterDelta);
            _gazeStopwatch.Restart();
        }
示例#6
0
        private void GazeDataStreamOnNext(object sender, GazePointEventArgs gazePointEventArgs)
        {
            LastGazePointEventArgs = gazePointEventArgs;

            const double screenExtensionFactor = 0;
            var          screenExtensionX      = host.ScreenBounds.Value.Width * screenExtensionFactor;
            var          screenExtensionY      = host.ScreenBounds.Value.Height * screenExtensionFactor;

            var gazePointX = gazePointEventArgs.X + screenExtensionX / 2;
            var gazePointY = gazePointEventArgs.Y + screenExtensionY / 2;

            var screenWidth  = host.ScreenBounds.Value.Width + screenExtensionX;
            var screenHeight = host.ScreenBounds.Value.Height + screenExtensionY;


            var normalizedGazePointX = (float)Math.Min(Math.Max((gazePointX / screenWidth), 0.0), 1.0);
            var normalizedGazePointY = (float)Math.Min(Math.Max((gazePointY / screenHeight), 0.0), 1.0);

            NormalizedGazePoint = new Vector2(normalizedGazePointX, normalizedGazePointY);

            var normalizedDistanceFromCenterX = (normalizedGazePointX - 0.5f) * 2.0f;
            var normalizedDistanceFromCenterY = (normalizedGazePointY - 0.5f) * 2.0f;

            NormalizedCenterDelta = new Vector2(normalizedDistanceFromCenterX, normalizedDistanceFromCenterY);

            UpdateReason = UpdateReason.GazeDataChanged;
            OnUpdate();
        }
示例#7
0
 private void GazeData(object sender, GazePointEventArgs e)
 {
     if (e.Timestamp != LastTimeStamp)
     {
         LastTimeStamp = e.Timestamp;
         OnGazeDataReceived(e.X, e.Y);
     }
 }
示例#8
0
        public GazePointEventArgs GetGazePoint()
        {
            GazePointEventArgs gp;

            lock (gaze)
                gp = new GazePointEventArgs(gaze.X, gaze.Y, gaze.Timestamp);
            return(gp);
        }
示例#9
0
        public GazePointEventArgs GetStableGazePoint()
        {
            GazePointEventArgs gp;

            lock (stableGaze)
                gp = new GazePointEventArgs(stableGaze.X, stableGaze.Y, stableGaze.Timestamp);
            return(gp);
        }
示例#10
0
 public void AddCalibration(CalibrationPoint point, GazePointEventArgs gaze)
 {
     if (!samples.Keys.Contains(point))
     {
         throw new ArgumentException("Calibration point given is not part of calibration set.");
     }
     samples[point].Add(gaze);
 }
示例#11
0
        /// <summary>
        /// Method get subscribed to eye tracker gaze event data stream, then runs methods that convert users current gaze into fixation events.
        /// </summary>
        /// <param name="o"></param>
        /// <param name="currentGaze"></param>
        private void updateGazeCoodinates(object o, GazePointEventArgs currentGaze)
        {
            addCoordinateToBuffer(currentGaze.X, currentGaze.Y);

            gPAverage = average();

            generateFixationState(calculateVariance(), currentGaze.Timestamp);
        }
示例#12
0
 private void GetPos(object sender, GazePointEventArgs e)
 {
     if (e.X > 0 && e.Y > 0)
     {
         Point eyePoint = new Point(e.X, e.Y);
         posList.Add(eyePoint);
     }
 }
示例#13
0
 private void _lightlyFilteredGazeDataStream_Next(object sender, GazePointEventArgs e)
 {
     _sampleCount++;
     if (_sampleCount % _sampleInterval == 0)
     {
         _samples.Enqueue(e);
         labelGazePoint.Text = $"Samples recorded: {_samples.Count} Gaze point at ({e.X:0.0}, {e.Y:0.0})";
     }
 }
示例#14
0
        private void StoreGazePoint(object sender, GazePointEventArgs args)
        {
            int elapsedMilliseconds = (int)(GetUnixMillisecondsForNow() - startTime);

            // If we are tracking Visual Studio locations

            VSLocation location = trackingVSLocation ? (VSLocation)GetVSWindowForScreenPoint(new System.Windows.Point(args.X, args.Y)) : VSLocation.Nothing;

            GazePoint gazePoint = new GazePoint((float)args.X, (float)args.Y, elapsedMilliseconds, location);

            gazePoints.Add(gazePoint);
        }
示例#15
0
        //This method is subscribed to a stream of user gaze points, which is a stream of points which are coordinates of where the users gaze currently is on screen.
        private void updateGazeCoodinates(object o, GazePointEventArgs currentGaze)
        {
            //Save the users gaze to a field that has global access in this class.
            currentGazeLocationX = currentGaze.X;
            currentGazeLocationY = currentGaze.Y;

            //if the users gaze goes off screen, Stop Scroll control running, this returns control back to the statemanager.
            if (checkIFGazeOffScreen(currentGaze.X, currentGaze.Y))
            {
                stopScroll();
            }
        }
        /// <summary>
        /// get the new xy gaze position on the screen, update the cursor position and make it move using MouseAction's method
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e">GazePointEventArgs</param>
        public void OnGazeDataStreamEvent(Object source, GazePointEventArgs e)
        {
            rawXPosition = (int)Math.Truncate(e.X);
            rawYPosition = (int)Math.Truncate(e.Y);

            updateXPosition = UpdateCursorPosition(rawXPosition, "x");
            updateYPosition = UpdateCursorPosition(rawYPosition, "y");

            if ((updateYPosition >= ScreenBottomLimit) && (Y_CursorAveragePosition_Remembered[r - 2] < ScreenBottomLimit))
            {
                OnCursorInBottomMidlleScreen(new EventArgs());
            }
        }
示例#17
0
 public void onGazeChanged(object s, GazePointEventArgs e)
 {
     if (Globs.server != null)
     {
         if (Globs.server.allSockets.Count > 0)
         {
             var eyeNavData = new EyeNavData(Globs.tracker.EyeTrackingDeviceStatus.Value, (int)e.Timestamp, e.X, e.Y);
             var json       = new JavaScriptSerializer().Serialize(eyeNavData);
             System.Console.WriteLine(json);
             Globs.server.sendToAll(json);
         }
     }
 }
示例#18
0
 private void gazeEvent(object sender, GazePointEventArgs e)
 {
     posX = e.X;
     posY = e.Y;
     //Display the point in a the pictureboxGaze
     pictureBoxGaze.Invalidate();
     //Update the estimation of number of read words.
     wordEstimation.update((float)posX, (float)posY, (float)e.Timestamp);
     //Reading / Not Reading estimation
     readingEstimation();
     labelEstWords.Invalidate();
     labelEstSpeed.Invalidate();
     labelReading.Invalidate();
     //Console.WriteLine("Gaze point at ({0:0.0}, {1:0.0}) @{2:0} - {3}", e.X, e.Y, e.Timestamp);
 }
示例#19
0
        private void gazeEvent(object sender, GazePointEventArgs e)
        {
            // Write the data to the console.
            Console.WriteLine("Gaze point at ({0:0.0}, {1:0.0}) @{2:0}", e.X, e.Y, e.Timestamp);
            linesGaze.Add(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss.FFF") + ";" + e.Timestamp + ";" + e.X + ";" + e.Y);

            //IF screenshot mode is ON
            if (takeScreenshot)
            {
                screenShotFrequency--;
                if (screenShotFrequency == 0)
                {
                    screenshot(filenameWithoutExtention + "_screenshots/" + e.Timestamp + ".png");
                    screenShotFrequency = 30;
                }
            }
        }
示例#20
0
        protected void UpdateGazePosition(object s, GazePointEventArgs data)
        {
            if (!double.IsNaN(data.X) && !double.IsNaN(data.Y))
            {
                System.Drawing.Point p = new System.Drawing.Point((int)data.X, (int)data.Y);
                sampleCount++;
                sampleIndex++;
                if (sampleIndex >= samples.Length)
                {
                    sampleIndex = 0;
                }
                samples[sampleIndex] = p;

                samplesHistory.Add(p);
                if (samplesHistory.Count > samplesHistorySize)
                {
                    samplesHistory.RemoveAt(0); //removes the oldest sample
                }
            }
        }
示例#21
0
        void SimpanPosisiMata(object sender, GazePointEventArgs e)
        {
            int[] PosisiMataSekarang = { (int)e.X, (int)e.Y };

            for (int i = ukuranFilterMata - 1; i > 0; i--)
            {
                PosisiMataAsli[0][i] = PosisiMataAsli[0][i - 1];
                PosisiMataAsli[1][i] = PosisiMataAsli[1][i - 1];
            }
            PosisiMataAsli[0][0] = PosisiMataSekarang[0];
            PosisiMataAsli[1][0] = PosisiMataSekarang[1];

            for (int i = ukuranKorelasi - 1; i > 0; i--)
            {
                PosisiMata[0][i] = PosisiMata[0][i - 1];
                PosisiMata[1][i] = PosisiMata[1][i - 1];
            }
            PosisiMata[0][0] = AverageFilter(PosisiMataAsli[0]);
            PosisiMata[1][0] = AverageFilter(PosisiMataAsli[1]);

            GeserPosisiTombol();
        }
示例#22
0
 private void InvokeGazePointEvent(object s, GazePointEventArgs e)
 {
     GazePointEvent.Invoke(s, e);
 }
 public void Add(GazePointEventArgs gazePoint)
 {
     movingAverageX.Progress(gazePoint.X);
     movingAverageY.Progress(gazePoint.Y);
     Timestamp = gazePoint.Timestamp;
 }
 //This method is subscribed to a stream of user gaze points, which is a stream of points which are coordinates of where the users gaze currently is on screen.
 private void updateGazeCoodinates(object o, GazePointEventArgs currentGaze)
 {
     //Save the users gaze to a field that has global access in this class.
     currentGazeLocationX = currentGaze.X;
     currentGazeLocationY = currentGaze.Y;
 }
 private void gazeDataStreamNext(object s, GazePointEventArgs e)
 {
     gazeX = e.X;
     gazeY = e.Y;
 }
 private void gazeDataStreamNext(object s, GazePointEventArgs e)
 {
     gazeX = e.X;
     gazeY = e.Y;
 }
示例#27
0
 private void Stream_Next(object sender, GazePointEventArgs e)
 {
     //drawCircle(100, 100);
     //textBox1.Text = "Gaze point at " + e.X + " " + e.Y;
     etmpx = e.X;
     etmpy = e.Y;
     ToList(new Point((int)((int)etmpx * eyeK), (int)((int)etmpy * eyeK) - DY));
     //gazeData.Add(this.PointToClient(new Point((int)etmpx, (int)etmpy)));
 }
示例#28
0
 private void GetPos(object sender, GazePointEventArgs e)
 {
     posX = e.X;
     posY = e.Y;
 }
示例#29
0
 void 視点情報格納(object s, GazePointEventArgs e)
 {
     POINT.Add(new int[]{(int)e.X,(int)e.Y});
 }
示例#30
0
        public MainWindowModel()
        {
            IsUserPresent = false;

            IsTrackingGaze          = false;
            IsTrackingGazeSupported = true;
            _hasEyesClosed          = false;

            // Create and start the WpfEyeXHost. Starting the host means
            // that it will connect to the EyeX Engine and be ready to
            // start receiving events and get the current values of
            // different engine states. In this sample we will be using
            // the UserPresence engine state.
            _eyeXHost = new WpfEyeXHost();

            // Register an status-changed event listener for UserPresence.
            // NOTE that the event listener must be unregistered too. This is taken care of in the Dispose(bool) method.
            _eyeXHost.UserPresenceChanged += EyeXHost_UserPresenceChanged;
            _eyeXHost.GazeTrackingChanged += EyeXHost_GazeTrackingChanged;

            //
            GazePointDataStream lightlyFilteredGazeDataStream = _eyeXHost.CreateGazePointDataStream(GazePointDataMode.LightlyFiltered);

            lightlyFilteredGazeDataStream.Next += (s, e) =>
            {
                //Console.WriteLine("Gaze point at ({0:0.0}, {1:0.0}) @{2:0}", e.X, e.Y, e.Timestamp);
                _lastEvent = e;
            };

            // TODO: make sure the app "magnifier" is running, or else the user has to restart pc if zoom breaks

            /*
             *
             * Process p = Process.Start("notepad.exe");
             * p.WaitForInputIdle();
             * IntPtr h = p.MainWindowHandle;
             * SetForegroundWindow(h);
             * SendKeys.SendWait("k");
             */

            MagInitialize();

            const int SM_CXSCREEN = 0;
            const int SM_CYSCREEN = 1;

            _screenWidth  = GetSystemMetrics(SM_CXSCREEN);
            _screenHeight = GetSystemMetrics(SM_CYSCREEN);
            Console.WriteLine("Screen {0}x{1}", _screenWidth, _screenHeight);
            // TODO maybe use virtual screen https://msdn.microsoft.com/en-us/library/windows/desktop/hh162714(v=vs.85).aspx

            // Start the EyeX host.
            _eyeXHost.Start();

            // Wait until we're connected.
            if (_eyeXHost.WaitUntilConnected(TimeSpan.FromSeconds(5)))
            {
                // Make sure the EyeX Engine version is equal to or greater than 1.4.
                var engineVersion = _eyeXHost.GetEngineVersion().Result;
                if (engineVersion.Major != 1 || engineVersion.Major == 1 && engineVersion.Minor < 4)
                {
                    IsTrackingGazeSupported = false;
                }
            }
        }
示例#31
0
 public FrameData()
 {
     Gaze = new GazePointEventArgs(0, 0, 0);
 }
示例#32
0
 public FrameData()
 {
     Gaze = new GazePointEventArgs(0, 0, 0);
 }
示例#33
0
        public void HandleEyeGazeEvent(object sender, GazePointEventArgs e)
        {
            //Console.WriteLine("Gaze point at\t{0:0.0}\t{1:0.0}\t\t{2:0}", e.X, e.Y, e.Timestamp);

            if (this.tcpServer.Connected && this.isGazeDataActive)
            {
                SendGaze((int)e.X, (int)e.Y, 0);
            }
        }
示例#34
0
        private void NewGazePoint(object sender, GazePointEventArgs gazePointEventArgs)
        {
            const double screenExtensionFactor = 0;
            var screenExtensionX = _host.ScreenBounds.Value.Width * screenExtensionFactor;
            var screenExtensionY = _host.ScreenBounds.Value.Height * screenExtensionFactor;

            var gazePointX = gazePointEventArgs.X + screenExtensionX / 2;
            var gazePointY = gazePointEventArgs.Y + screenExtensionY / 2;

            var screenWidth = _host.ScreenBounds.Value.Width + screenExtensionX;
            var screenHeight = _host.ScreenBounds.Value.Height + screenExtensionY;

            if (screenHeight > 0)
            {
                _aspectRatio = screenWidth/screenHeight;
            }

            var normalizedGazePointX = (float)Math.Min(Math.Max((gazePointX / screenWidth), 0.0), 1.0);
            var normalizedGazePointY = (float)Math.Min(Math.Max((gazePointY / screenHeight), 0.0), 1.0);

            var normalizedCenterDeltaX = (normalizedGazePointX - 0.5f) * 2.0f;
            var normalizedCenterDeltaY = (normalizedGazePointY - 0.5f) * 2.0f;
            if (float.IsNaN(normalizedCenterDeltaX) || float.IsNaN(normalizedCenterDeltaY)) return;

            _lastNormalizedCenterDelta = new Vector2(normalizedCenterDeltaX, normalizedCenterDeltaY);
            _gazeVisualization.MovePoint(_lastNormalizedCenterDelta);
            _gazeStopwatch.Restart();
        }
示例#35
0
 private void updateGazeCoodinates(object o, GazePointEventArgs currentGaze)
 {
     //Save the users current gaze location.
     currentGazeLocationX = currentGaze.X;
     currentGazeLocationY = currentGaze.Y;
 }
示例#36
0
 void OnGazePointNext(object sender, GazePointEventArgs e)
 {
     RaiseGazeEvent(e.X, e.Y, e.Timestamp);
 }
    private void NewGazePoint(object sender, GazePointEventArgs gazePointEventArgs)
    {
        const double screenExtensionFactor = 0;
        var screenExtensionX = _host.ScreenBounds.Value.Width * screenExtensionFactor;
        var screenExtensionY = _host.ScreenBounds.Value.Height * screenExtensionFactor;

        var gazePointX = gazePointEventArgs.X + screenExtensionX / 2;
        var gazePointY = gazePointEventArgs.Y + screenExtensionY / 2;

        var screenWidth = _host.ScreenBounds.Value.Width + screenExtensionX;
        var screenHeight = _host.ScreenBounds.Value.Height + screenExtensionY;

        if (screenHeight > 0)
        {
            AspectRatio = (float) (screenWidth / screenHeight);
        }

        var normalizedGazePointX = (float)Math.Min(Math.Max(gazePointX / screenWidth, 0.0), 1.0);
        var normalizedGazePointY = (float)Math.Min(Math.Max(gazePointY / screenHeight, 0.0), 1.0);

        var normalizedCenterDeltaX = (normalizedGazePointX - 0.5f) * 2.0f;
        var normalizedCenterDeltaY = (normalizedGazePointY - 0.5f) * 2.0f;
        if (float.IsNaN(normalizedCenterDeltaX) || float.IsNaN(normalizedCenterDeltaY)) return;

        GazeX = normalizedCenterDeltaX;
        GazeY = normalizedCenterDeltaY;
    }
示例#38
0
文件: Form1.cs 项目: moyoron64/eyeX
        //見ている座標の更新
        private void OutputGazePoint(object sender, GazePointEventArgs e)
        {


            gazeX = e.X;
            gazeY = e.Y;
            /*
            double x3 = listBox1.Location.X;
            double y3 = listBox1.Location.Y;

            if (System.Math.Abs(listBox1.Location.X - gazeX) > 20  )
            {
                x3 += (e.X * 0.08) - (0.08 * x3);

            }
            if(System.Math.Abs(listBox1.Location.Y - gazeY) > 20){
                y3 += (e.Y * 0.08) - (0.08 * y3) + 5;

            }
                listBox1.Location = new System.Drawing.Point((int)(x3), (int)(y3));
            */

        }