コード例 #1
0
        ///////////////////////////////////////////////////////////////////////////////
        // Methods for doing main class job                                          //
        ///////////////////////////////////////////////////////////////////////////////
        #region METHODS

        /// <summary>
        /// The method runs the calibration of the Smart Eye device.
        /// </summary>
        /// <returns>A list of <see cref="CalibrationResult"/> objects</returns>
        public List <CalibrationResult> RunCalibration()
        {
            if (this.PrepareForCalibration())
            {
                PresentationScreen.PutFormOnPresentationScreen(this.smartEyeCalibrationForm, true);
                this.smartEyeCalibrationForm.ShowDialog();

                return(this.calibrationResult);
            }

            return(null);
        }
コード例 #2
0
        /// <summary>
        /// The method runs the calibration of the tobii device.
        /// </summary>
        /// <param name="givenTracker">The <see cref="IEyetracker"/> tracker</param>
        /// <returns>A <see cref="Calibration"/> object</returns>
        public Calibration RunCalibration(IEyetracker givenTracker)
        {
            this.CreatePointList();

            this.tracker = givenTracker;
            this.tracker.ConnectionError += this.HandleConnectionError;

            // Inform the eyetracker that we want to run a calibration
            this.tracker.StartCalibration();

            this.tobiiCalibrationForm.ClearCalibrationPoint();
            PresentationScreen.PutFormOnPresentationScreen(this.tobiiCalibrationForm, true);
            this.tobiiCalibrationForm.ShowDialog();

            // Inform the eyetracker that we have finished
            // the calibration routine
            this.tracker.StopCalibration();

            return(this.calibrationResult);
        }
コード例 #3
0
ファイル: SMIiViewXClient.cs プロジェクト: zhjh-stack/ogama
        /// <summary>
        /// This method performs a unrandomized nine point calibration.
        /// </summary>
        public void Calibrate()
        {
            if (!this.IsConnected)
            {
                this.Connect();
            }

            // Get presentation size
            Size presentationSize = PresentationScreen.GetPresentationResolution();

            // Set calibration area size
            this.SendString("ET_CSZ " + presentationSize.Width.ToString() + " " + presentationSize.Height.ToString());


            // Set calibration points
            int          fivePercentX      = (int)(0.05f * presentationSize.Width);
            int          fivePercentY      = (int)(0.05f * presentationSize.Height);
            int          xHalf             = presentationSize.Width / 2;
            int          yHalf             = presentationSize.Height / 2;//was Width
            Point        topLeft           = new Point(fivePercentX, fivePercentY);
            Point        topMiddle         = new Point(xHalf, fivePercentY);
            Point        topRight          = new Point(presentationSize.Width - fivePercentX, fivePercentY);
            Point        middleLeft        = new Point(fivePercentX, yHalf);
            Point        center            = new Point(xHalf, yHalf);
            Point        middleRight       = new Point(presentationSize.Width - fivePercentX, yHalf);
            Point        bottomLeft        = new Point(fivePercentX, presentationSize.Height - fivePercentY);
            Point        bottomMiddle      = new Point(xHalf, presentationSize.Height - fivePercentY);
            Point        bottomRight       = new Point(presentationSize.Width - fivePercentX, presentationSize.Height - fivePercentY);
            List <Point> calibrationPoints = new List <Point>();

            calibrationPoints.Add(center);
            calibrationPoints.Add(topLeft);
            calibrationPoints.Add(topRight);
            calibrationPoints.Add(bottomLeft);
            calibrationPoints.Add(bottomRight);
            calibrationPoints.Add(middleLeft);
            calibrationPoints.Add(topMiddle);
            calibrationPoints.Add(middleRight);
            calibrationPoints.Add(bottomMiddle);

            ////this.SendString("ET_PNT 1 " + center.X.ToString() + " " + center.Y.ToString());
            ////this.SendString("ET_PNT 2 " + topLeft.X.ToString() + " " + topLeft.Y.ToString());
            ////this.SendString("ET_PNT 3 " + topRight.X.ToString() + " " + topRight.Y.ToString());
            ////this.SendString("ET_PNT 4 " + bottomLeft.X.ToString() + " " + bottomLeft.Y.ToString());
            ////this.SendString("ET_PNT 5 " + bottomRight.X.ToString() + " " + bottomRight.Y.ToString());

            this.newCalibrationForm = new SMIiViewXCalibrationForm();
            this.newCalibrationForm.CalibPointColor   = this.smiSettings.CalibPointColor;
            this.newCalibrationForm.CalibPointSize    = this.smiSettings.CalibPointSize;
            this.newCalibrationForm.BackColor         = this.smiSettings.CalibBackgroundColor;
            this.newCalibrationForm.Width             = presentationSize.Width;
            this.newCalibrationForm.Height            = presentationSize.Height;
            this.newCalibrationForm.CalibrationPoints = calibrationPoints;


            PresentationScreen.PutFormOnPresentationScreen(this.newCalibrationForm, true);

            this.newCalibrationForm.Show();

            // Starts calibration.
            this.SendString("ET_CAL 9");

            // Wait 2 seconds at the center point.
            int counter = 0;

            do
            {
                Application.DoEvents();
                Thread.Sleep(100);
                counter++;
            }while (counter < 50);

            // Accepts calibration point.
            this.SendString("ET_ACC");
        }