Example #1
0
        private void tetClientEvents_OnGazeData(ref TetGazeData gazeData)
        {
            float x, y, distance;
            bool  valid = true;

            // Use data only if both left and right eye was found by the eye tracker
            if (gazeData.validity_lefteye == 0 || gazeData.validity_righteye == 0)
            {
                // Let the x, y and distance be the right and left eye average
                if (gazeData.validity_lefteye == 0 && gazeData.validity_righteye != 0)
                {
                    x        = gazeData.x_gazepos_lefteye;
                    y        = gazeData.y_gazepos_lefteye;
                    distance = gazeData.distance_lefteye;
                }
                else if (gazeData.validity_lefteye != 0 && gazeData.validity_righteye == 0)
                {
                    x        = gazeData.x_gazepos_righteye;
                    y        = gazeData.y_gazepos_righteye;
                    distance = gazeData.distance_righteye;
                }
                else if (gazeData.validity_lefteye == 0 && gazeData.validity_righteye == 0)
                {
                    x        = (gazeData.x_gazepos_lefteye + gazeData.x_gazepos_righteye) / 2;
                    y        = (gazeData.y_gazepos_lefteye + gazeData.y_gazepos_righteye) / 2;
                    distance = (gazeData.distance_lefteye + gazeData.distance_righteye) / 2;
                }
                else
                {
                    valid    = false;
                    x        = y = 0.0F;
                    distance = 400.0F;
                }

                // Set position, size and color of gaze form
                if (valid)
                {
                    //gazeForm.Width = gazeForm.Height = (int)((distance - 400) * 0.3);
                    //gazeForm.Left = (int)(x * Screen.PrimaryScreen.Bounds.Width) - gazeForm.Width / 2;
                    //gazeForm.Top = (int)(y * Screen.PrimaryScreen.Bounds.Height) - gazeForm.Height / 2;
                    //gazeForm.BackColor = Color.FromArgb((int)distance % 255, 255 - ((int)distance % 255), 50);
                    //eyeDisplay.Display((int)(x * Screen.PrimaryScreen.Bounds.Width), (int)(y * Screen.PrimaryScreen.Bounds.Height));
                    zoomX = (int)(x * Screen.PrimaryScreen.Bounds.Width);
                    zoomY = (int)(y * Screen.PrimaryScreen.Bounds.Height);
                }
                else
                {
                    //gazeForm.Width = gazeForm.Height = 20;
                    //gazeForm.Left = (int)(Screen.PrimaryScreen.Bounds.Width / 2 - gazeForm.Width / 2);
                    //gazeForm.Top = (int)(Screen.PrimaryScreen.Bounds.Height / 2 - gazeForm.Height / 2);
                    //gazeForm.BackColor = Color.Blue;
                }
            }
        }
Example #2
0
        private void TetClientEvent_OnGazeData(ref TetGazeData gazeData)
        {
            float  x, y;
            double xCoord, yCoord;
            int    SCREEN_WIDTH  = 1280;
            int    SCREEN_HEIGHT = 1024;


            //Use data only if both the left and right eyes are found by the eye tracker
            if (gazeData.validity_lefteye == 0 && gazeData.validity_righteye == 0)
            {
                // let the x and y be the average of the left and right eye
                x = (gazeData.x_gazepos_lefteye + gazeData.x_gazepos_righteye) / 2;
                y = (gazeData.y_gazepos_lefteye + gazeData.y_gazepos_righteye) / 2;

                xCoord = x * SCREEN_WIDTH;
                yCoord = y * SCREEN_HEIGHT;

                _gazePoint = new Point(xCoord, yCoord);
            } //if interaction
        }     //method
        private void TetClientEvent_OnGazeData(ref TetGazeData gazeData)
        {
            float x, y;
               double xCoord, yCoord;
               int SCREEN_WIDTH = 1280;
               int SCREEN_HEIGHT = 1024;

               //Use data only if both the left and right eyes are found by the eye tracker
               if (gazeData.validity_lefteye == 0 && gazeData.validity_righteye == 0)
               {

                   // let the x and y be the average of the left and right eye
                   x = (gazeData.x_gazepos_lefteye + gazeData.x_gazepos_righteye) / 2;
                   y = (gazeData.y_gazepos_lefteye + gazeData.y_gazepos_righteye) / 2;

                   xCoord = x * SCREEN_WIDTH;
                   yCoord = y * SCREEN_HEIGHT;

                   _gazePoint = new Point(xCoord, yCoord);

               }//if interaction
        }
Example #4
0
        private void tetClientEvents_OnGazeData(ref TetGazeData gazeData)
        {
            float x, y, distance;
            bool valid = true;

            // Use data only if both left and right eye was found by the eye tracker
            if (gazeData.validity_lefteye == 0 || gazeData.validity_righteye == 0)
            {
                // Let the x, y and distance be the right and left eye average
                if (gazeData.validity_lefteye == 0 && gazeData.validity_righteye != 0)
                {
                    x = gazeData.x_gazepos_lefteye;
                    y = gazeData.y_gazepos_lefteye;
                    distance = gazeData.distance_lefteye;
                }
                else if (gazeData.validity_lefteye != 0 && gazeData.validity_righteye == 0)
                {
                    x = gazeData.x_gazepos_righteye;
                    y = gazeData.y_gazepos_righteye;
                    distance = gazeData.distance_righteye;
                }
                else if (gazeData.validity_lefteye == 0 && gazeData.validity_righteye == 0)
                {
                    x = (gazeData.x_gazepos_lefteye + gazeData.x_gazepos_righteye) / 2;
                    y = (gazeData.y_gazepos_lefteye + gazeData.y_gazepos_righteye) / 2;
                    distance = (gazeData.distance_lefteye + gazeData.distance_righteye) / 2;
                }
                else
                {
                    valid = false;
                    x = y = 0.0F;
                    distance = 400.0F;
                }

                // Set position, size and color of gaze form
                if (valid)
                {

                    //gazeForm.Width = gazeForm.Height = (int)((distance - 400) * 0.3);
                    //gazeForm.Left = (int)(x * Screen.PrimaryScreen.Bounds.Width) - gazeForm.Width / 2;
                    //gazeForm.Top = (int)(y * Screen.PrimaryScreen.Bounds.Height) - gazeForm.Height / 2;
                    //gazeForm.BackColor = Color.FromArgb((int)distance % 255, 255 - ((int)distance % 255), 50);
                    //eyeDisplay.Display((int)(x * Screen.PrimaryScreen.Bounds.Width), (int)(y * Screen.PrimaryScreen.Bounds.Height));
                    zoomX = (int)(x * Screen.PrimaryScreen.Bounds.Width);
                    zoomY = (int)(y * Screen.PrimaryScreen.Bounds.Height);

                }
                else
                {
                    //gazeForm.Width = gazeForm.Height = 20;
                    //gazeForm.Left = (int)(Screen.PrimaryScreen.Bounds.Width / 2 - gazeForm.Width / 2);
                    //gazeForm.Top = (int)(Screen.PrimaryScreen.Bounds.Height / 2 - gazeForm.Height / 2);
                    //gazeForm.BackColor = Color.Blue;
                }
            }
        }