コード例 #1
0
    /// <summary> Start a new calibration, based on the parameters set via the inspector. </summary>
    /// <param name="whichFingers"></param>
    /// <returns></returns>
    public bool StartCalibration(bool[] whichFingers = null)
    {
        if (this.GloveReady())
        {
            if (whichFingers == null)
            {
                whichFingers = new bool[] { false, true, true, true, true };
            }

            CalibrationAlgorithm algorithm = null;
            switch (this.calibrationAlgorithm)
            {
            case Algorithm.PointsOnACircle2D: algorithm = new Circle2D(whichFingers); break;
            }
            if (algorithm != null)
            {
                CalibrationMethod method = null;
                switch (this.calibrationMethod)
                {
                case CalibrationType.Manual: method = new ManualCalibration(algorithm, this.async); break;

                case CalibrationType.SemiAutomatic: method = new SemiAutoCalibration(algorithm, this.async, 12, 0.6f, 5); break;

                case CalibrationType.Automatic: method = new AutoCalibration(algorithm, this.async); break;
                }
                if (method != null)
                {
                    this.glove.StartCalibration(method);
                    this.calibrating = true;
                }
            }
        }
        return(false);
    }
コード例 #2
0
    public void TestCalibration()
    {
        if (this.glove != null && this.gloveReady)
        {
            int[][][] angles = new int[3][][];
            //fill with zeroes
            for (int i = 0; i < angles.Length; i++)
            {
                angles[i] = new int[5][];
                for (int f = 0; f < angles[i].Length; f++)
                {
                    angles[i][f] = new int[] { 0, 0, 0 };
                }
            }
            angles[0][1] = new int[] { 0, 0, 0 };
            angles[1][1] = new int[] { 1, 100, 90 };
            angles[2][1] = new int[] { 80, 100, 80 };

            CalibrationAlgorithm testAlgorithm = new ThreeGestures2D(new bool[] { false, true, true, true, true }, angles);
            CalibrationMethod    testMethod    = new SemiAutoCalibration(testAlgorithm, true, 10, 2.0f, 5);

            this.glove.StartCalibration(testMethod);
        }
    }