Ejemplo n.º 1
0
        public void doCalibration()
        {
            if (cf == null)
            {
                return;
            }
            int x    = 0;
            int y    = 0;
            int size = 25;
            Pen p    = new Pen(Color.Red);

            switch (calibrationState)
            {
            case 1:
                x = (int)(screenWidth * calibrationMargin);
                y = (int)(screenHeight * calibrationMargin);
                cf.showCalibration(x, y, size, p);
                dstX[calibrationState - 1] = x;
                dstY[calibrationState - 1] = y;
                break;

            case 2:
                x = screenWidth - (int)(screenWidth * calibrationMargin);
                y = (int)(screenHeight * calibrationMargin);
                cf.showCalibration(x, y, size, p);
                dstX[calibrationState - 1] = x;
                dstY[calibrationState - 1] = y;
                break;

            case 3:
                x = (int)(screenWidth * calibrationMargin);
                y = screenHeight - (int)(screenHeight * calibrationMargin);
                cf.showCalibration(x, y, size, p);
                dstX[calibrationState - 1] = x;
                dstY[calibrationState - 1] = y;
                break;

            case 4:
                x = screenWidth - (int)(screenWidth * calibrationMargin);
                y = screenHeight - (int)(screenHeight * calibrationMargin);
                cf.showCalibration(x, y, size, p);
                dstX[calibrationState - 1] = x;
                dstY[calibrationState - 1] = y;
                break;

            case 5:
                //compute warp
                warper.setDestination(dstX[0], dstY[0], dstX[1], dstY[1], dstX[2], dstY[2], dstX[3], dstY[3]);
                warper.setSource(srcX[0], srcY[0], srcX[1], srcY[1], srcX[2], srcY[2], srcX[3], srcY[3]);
                warper.computeWarp();
                cf.Close();
                cf = null;
                calibrationState = 0;
                cursorControl    = true;
                BeginInvoke((MethodInvoker) delegate() { cbCursorControl.Checked = cursorControl; });
//                    saveCalibrationData();
                UpdateTrackingUtilization();
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
        public void DoCalibration()
        {
            if (cf == null)
            {
                return;
            }

            int x;
            int y;
            int size = 25;
            Pen p    = new Pen(Color.Red);

            switch (_calibrationState)
            {
            case 1:
                x = (int)(_screenSize.Width * _calibrationMargin);
                y = (int)(_screenSize.Height * _calibrationMargin);
                cf.ShowCalibration(x, y, size, p);
                _dstX[_calibrationState - 1] = x;
                _dstY[_calibrationState - 1] = y;
                break;

            case 2:
                x = _screenSize.Width - (int)(_screenSize.Width * _calibrationMargin);
                y = (int)(_screenSize.Height * _calibrationMargin);
                cf.ShowCalibration(x, y, size, p);
                _dstX[_calibrationState - 1] = x;
                _dstY[_calibrationState - 1] = y;
                break;

            case 3:
                x = (int)(_screenSize.Width * _calibrationMargin);
                y = _screenSize.Height - (int)(_screenSize.Height * _calibrationMargin);
                cf.ShowCalibration(x, y, size, p);
                _dstX[_calibrationState - 1] = x;
                _dstY[_calibrationState - 1] = y;
                break;

            case 4:
                x = _screenSize.Width - (int)(_screenSize.Width * _calibrationMargin);
                y = _screenSize.Height - (int)(_screenSize.Height * _calibrationMargin);
                cf.ShowCalibration(x, y, size, p);
                _dstX[_calibrationState - 1] = x;
                _dstY[_calibrationState - 1] = y;
                break;

            case 5:
                //compute warp
                _warper.SetDestination(_dstX[0], _dstY[0], _dstX[1], _dstY[1], _dstX[2], _dstY[2], _dstX[3], _dstY[3]);
                _warper.SetSource(_srcX[0], _srcY[0], _srcX[1], _srcY[1], _srcX[2], _srcY[2], _srcX[3], _srcY[3]);
                _warper.ComputeWarp();
                _calibrationState = 0;
                _cursorControl    = true;
                BeginInvoke((MethodInvoker) delegate() { cf.Close(); cbCursorControl.Checked = _cursorControl; });
                SaveCalibrationData();
                UpdateTrackingUtilization();
                break;

            default:
                break;
            }
        }