Пример #1
0
        /// <summary>
        /// Define la posicion del centro de los puntos de calibracion
        /// </summary>
        private void generateCalibrationPoints()
        {
            int                     Width                 = Screen.PrimaryScreen.Bounds.Width;
            int                     Height                = Screen.PrimaryScreen.Bounds.Height;
            double                  offsetX               = (double)calibrationPointOffset / (double)Width;
            double                  offsetY               = (double)calibrationPointOffset / (double)Height;
            calibrationPoint        puntoCalibracion      = new calibrationPoint();
            List <calibrationPoint> puntoCalibracionLista = new List <calibrationPoint>();

            /*
             * (x,y)
             *
             *  1(offset,offset)        2(Width/2,offset)           3(Width-offset,offset)
             *  4(offset,Height/2)      5(Width/2,Height/2)         6(Width-offset,Height/2)
             *  7(offset,Height-offset) 8(Width/2,Height-offset)    9(Width-offset,Height-offset)
             */

            puntoCalibracion.positionEyeTribe = new Tobii.Gaze.Core.Point2D(calibrationPointOffset, calibrationPointOffset);//1
            puntoCalibracion.positionEyeX     = new Tobii.Gaze.Core.Point2D(offsetX, offsetY);
            puntoCalibracion.imagen           = Properties.Resources.boxer;
            puntoCalibracionLista.Add(puntoCalibracion);

            puntoCalibracion.positionEyeTribe = new Tobii.Gaze.Core.Point2D(Width - calibrationPointOffset, calibrationPointOffset);//3
            puntoCalibracion.positionEyeX     = new Tobii.Gaze.Core.Point2D(1 - offsetX, offsetY);
            puntoCalibracion.imagen           = Properties.Resources.cotorritas;
            puntoCalibracionLista.Add(puntoCalibracion);

            puntoCalibracion.positionEyeTribe = new Tobii.Gaze.Core.Point2D(Width / 2, Height / 2); //5
            puntoCalibracion.positionEyeX     = new Tobii.Gaze.Core.Point2D(0.5, 0.5);
            puntoCalibracion.imagen           = Properties.Resources.salchicha;                     //pajaro
            puntoCalibracionLista.Add(puntoCalibracion);

            puntoCalibracion.positionEyeTribe = new Tobii.Gaze.Core.Point2D(calibrationPointOffset, Height - calibrationPointOffset);//7
            puntoCalibracion.positionEyeX     = new Tobii.Gaze.Core.Point2D(offsetX, 1 - offsetY);
            puntoCalibracion.imagen           = Properties.Resources.cachorritoSubir;
            puntoCalibracionLista.Add(puntoCalibracion);

            puntoCalibracion.positionEyeTribe = new Tobii.Gaze.Core.Point2D(Width - calibrationPointOffset, Height - calibrationPointOffset);//9
            puntoCalibracion.positionEyeX     = new Tobii.Gaze.Core.Point2D(1 - offsetX, 1 - offsetY);
            puntoCalibracion.imagen           = Properties.Resources.catAndFox;
            puntoCalibracionLista.Add(puntoCalibracion);


            numeroPuntosCalibracion = puntoCalibracionLista.Count;
            int[] order = new int[numeroPuntosCalibracion];

            for (var c = 0; c < numeroPuntosCalibracion; c++)
            {
                order[c] = c;
            }

            Shuffle(order);

            foreach (int number in order)
            {
                puntoCalibracion = puntoCalibracionLista[number];
                calibrationPoints.Enqueue(puntoCalibracion);
            }
        }
        private void CalibrationWinForm_Load(object sender, EventArgs e)
        {
            pictureBoxCalibrationImage.Size = bigImage;
            currentCalibrationPoint         = setCalibrationPoint();

            if (eyeTrackerReady2Calibrate && (settings.eyetrackerSelected == Definitions.eyetrackertype.tobii))
            {
                startTimersEyeX();
            }
        }
 private void relocateCalibrationImage(calibrationPoint calibrationPoint)
 {
     pictureBoxCalibrationImage.BeginInvoke((Action)(() =>
     {
         pictureBoxCalibrationImage.Location = new Point(
             Convert.ToInt32(calibrationPoint.positionPx.X) - (pictureBoxCalibrationImage.Width / 2),
             Convert.ToInt32(calibrationPoint.positionPx.Y) - (pictureBoxCalibrationImage.Height / 2)
             );
         pictureBoxCalibrationImage.Image = calibrationPoint.imagen;
     }));
 }
        private calibrationPoint setCalibrationPoint()
        {
            calibrationPoint calibrationPointSelected;

            if (calibrationPoints.Count != 0)
            {
                calibrationPointSelected = calibrationPoints.Dequeue();
                relocateCalibrationImage(calibrationPointSelected);
                return(calibrationPointSelected);
            }
            else
            {
                calibrationPointSelected        = new calibrationPoint();
                calibrationPointSelected.imagen = null;
                return(calibrationPointSelected);
            }
        }
        private void timerPostShow_Tick_EyeX(object sender, EventArgs e)
        {
            timerPostShow.Stop();
            currentCalibrationPoint = setCalibrationPoint();

            if (currentCalibrationPoint.imagen != null)
            {
                timerPreShow.Start();
            }
            else
            {
                timerPreShow.Tick  -= new EventHandler(timerPreShow_Tick_EyeX);
                timerPostShow.Tick -= new EventHandler(timerPostShow_Tick_EyeX);

                Console.WriteLine("CalibrationWinForm.timerLatency_Tick_EyeX: final");
                eyeTrackingEngine.ComputeAndSetCalibration();
            }
        }
        /// <summary>
        /// Define la posicion del centro de los puntos de calibracion
        /// </summary>
        private void generateCalibrationPoints()
        {
            int                     Width                 = Screen.AllScreens[0].Bounds.Width;
            int                     Height                = Screen.AllScreens[0].Bounds.Height;
            double                  offsetX               = (double)calibrationPointOffset / (double)Width;
            double                  offsetY               = (double)calibrationPointOffset / (double)Height;
            calibrationPoint        puntoCalibracion      = new calibrationPoint();
            List <calibrationPoint> puntoCalibracionLista = new List <calibrationPoint>();

            /*
             * (x,y)
             *
             *  1(offset,offset)        2(Width/2,offset)           3(Width-offset,offset)
             *  4(offset,Height/2)      5(Width/2,Height/2)         6(Width-offset,Height/2)
             *  7(offset,Height-offset) 8(Width/2,Height-offset)    9(Width-offset,Height-offset)
             */

            puntoCalibracion.positionPx               = new LookAndPlayForm.Resumen.Point2D();//1
            puntoCalibracion.positionPx.X             = calibrationPointOffset;
            puntoCalibracion.positionPx.Y             = calibrationPointOffset;
            puntoCalibracion.positionEyeX_Normalizada = new Tobii.Gaze.Core.Point2D(offsetX, offsetY);
            puntoCalibracion.imagen = Properties.Resources.cocodrilo;
            puntoCalibracionLista.Add(puntoCalibracion);

            //puntoCalibracion.positionEyeTribe = new Point2D(Width / 2, calibrationPointOffset);//2
            //puntoCalibracion.positionEyeX = new Tobii.Gaze.Core.Point2D(0.5, offsetY);
            //puntoCalibracion.imagen = Properties.Resources.tigre;
            //puntoCalibracionLista.Add(puntoCalibracion);

            puntoCalibracion.positionPx               = new LookAndPlayForm.Resumen.Point2D();//3
            puntoCalibracion.positionPx.X             = Width - calibrationPointOffset;
            puntoCalibracion.positionPx.Y             = calibrationPointOffset;
            puntoCalibracion.positionEyeX_Normalizada = new Tobii.Gaze.Core.Point2D(1 - offsetX, offsetY);
            puntoCalibracion.imagen = Properties.Resources.elefante;
            puntoCalibracionLista.Add(puntoCalibracion);

            //puntoCalibracion.positionEyeTribe = new Point2D(calibrationPointOffset, Height / 2);//4
            //puntoCalibracion.positionEyeX = new Tobii.Gaze.Core.Point2D(offsetX, 0.5);
            //puntoCalibracion.imagen = Properties.Resources.mono;
            //puntoCalibracionLista.Add(puntoCalibracion);

            puntoCalibracion.positionPx               = new LookAndPlayForm.Resumen.Point2D();//5
            puntoCalibracion.positionPx.X             = Width / 2;
            puntoCalibracion.positionPx.Y             = Height / 2;
            puntoCalibracion.positionEyeX_Normalizada = new Tobii.Gaze.Core.Point2D(0.5, 0.5);
            puntoCalibracion.imagen = Properties.Resources.sapo;
            puntoCalibracionLista.Add(puntoCalibracion);

            //puntoCalibracion.positionEyeTribe = new Point2D(Width - calibrationPointOffset, Height / 2);//6
            //puntoCalibracion.positionEyeX = new Tobii.Gaze.Core.Point2D(1 - offsetX, 0.5);
            //puntoCalibracion.imagen = Properties.Resources.pavo;
            //puntoCalibracionLista.Add(puntoCalibracion);

            puntoCalibracion.positionPx               = new LookAndPlayForm.Resumen.Point2D();//7
            puntoCalibracion.positionPx.X             = calibrationPointOffset;
            puntoCalibracion.positionPx.Y             = Height - calibrationPointOffset;
            puntoCalibracion.positionEyeX_Normalizada = new Tobii.Gaze.Core.Point2D(offsetX, 1 - offsetY);
            puntoCalibracion.imagen = Properties.Resources.pez;
            puntoCalibracionLista.Add(puntoCalibracion);

            //puntoCalibracion.positionEyeTribe = new Point2D(Width / 2, Height - calibrationPointOffset);//8
            //puntoCalibracion.positionEyeX = new Tobii.Gaze.Core.Point2D(0.5, 1 - offsetY);
            //puntoCalibracion.imagen = Properties.Resources.raton;
            //puntoCalibracionLista.Add(puntoCalibracion);

            puntoCalibracion.positionPx               = new LookAndPlayForm.Resumen.Point2D();//9
            puntoCalibracion.positionPx.X             = Width - calibrationPointOffset;
            puntoCalibracion.positionPx.Y             = Height - calibrationPointOffset;
            puntoCalibracion.positionEyeX_Normalizada = new Tobii.Gaze.Core.Point2D(1 - offsetX, 1 - offsetY);
            puntoCalibracion.imagen = Properties.Resources.tortuga;
            puntoCalibracionLista.Add(puntoCalibracion);



            numeroPuntosCalibracion = puntoCalibracionLista.Count;
            //int[] order = new int[numeroPuntosCalibracion];
            int[] order = new int[numeroPuntosCalibracion];

            for (var c = 0; c < numeroPuntosCalibracion; c++)
            {
                order[c] = c;
            }

            Shuffle(order);

            foreach (int number in order)
            {
                puntoCalibracion = puntoCalibracionLista[number];
                calibrationPoints.Enqueue(puntoCalibracion);
            }
        }
Пример #7
0
 private void CalibrationWinForm_Load(object sender, EventArgs e)
 {
     pictureBoxCalibrationImage.Size = bigImage;
     currentCalibrationPoint         = setCalibrationPoint();
     startTimersEyeX();
 }