Example #1
0
        private void RecognizeGesture()
        {
            Gesture candidate    = new Gesture(points.ToArray());
            string  gestureClass = "";
            string  recognizer   = "";

            switch (cbRecognizer.SelectedIndex)
            {
            case 0:
                recognizer   = "$P";
                gestureClass = PointCloudRecognizer.Classify(candidate, trainingSet);
                break;

            case 1:
                recognizer   = "$P+";
                gestureClass = PointCloudRecognizerPlus.Classify(candidate, trainingSet);
                break;

            case 2:
                recognizer = "$Q";
                QPointCloudRecognizer.UseEarlyAbandoning = chkUseEarlyAbandoning.Checked;
                QPointCloudRecognizer.UseLowerBounding   = chkUseLowerBounding.Checked;
                gestureClass = QPointCloudRecognizer.Classify(candidate, trainingSet);
                break;
            }
            MessageBox.Show("Recognized as: " + gestureClass, recognizer);
        }
Example #2
0
    public void RecognizeShape()
    {
        recognized = true;

        if (points.Count > 0)
        {
            Gesture candidate = new Gesture(points.ToArray());

            Result gestureResult = QPointCloudRecognizer.ClassifyWithResult(candidate, trainingSet.ToArray());



            /*Fire off the event with the spell we've gotten
             * TODO: maybe log if a shape wasn't detected
             * This will come in handy if we extend the recognizer to discard any shapes that are badly draw for example
             */
            onSpellRecognized.Raise(spellList.GetSpell(gestureResult.GestureClass));

            Debug.Log(gestureResult.GestureClass);
        }

        strokeID = -1;

        points.Clear();

        foreach (UILineRendererList lineRenderer in gestureLinesRenderer)
        {
            Destroy(lineRenderer.gameObject);
        }

        gestureLinesRenderer.Clear();
    }
Example #3
0
    public void RecognizeShape()
    {
        recognized = true;

        Gesture candidate = new Gesture(points.ToArray());

        Result gestureResult = QPointCloudRecognizer.ClassifyWithResult(candidate, trainingSet.ToArray());

        resultText.text = gestureResult.GestureClass;
    }
Example #4
0
    //Recognize a gesture
    private void RecognizeGesture()
    {
        Gesture candidate    = new Gesture(points.ToArray(), "tester");
        string  gestureClass = "";

        QPointCloudRecognizer.UseEarlyAbandoning = useEarlyAbandoning;
        QPointCloudRecognizer.UseLowerBounding   = useLowerBounding;
        gestureClass = QPointCloudRecognizer.Classify(candidate, trainingSet);
        Debug.Log("Recognized as: " + gestureClass);
        txt.text += gestureClass;
    }
    private static PassStuff ClassifyScore(Gesture candidate, float maxDistance)
    {
        PassStuff ps = null;

        switch (currentClassifier)
        {
        case ClassifierClass.PointCloud:
            if (showDebugMsg)
            {
                Debug.Log("Point cloud");
            }
            ps = PointCloudRecognizer.ClassifyScore(candidate, gestureSet);
            break;

        case ClassifierClass.PointCloudPlus:
            if (showDebugMsg)
            {
                Debug.Log("Point cloud PLUS");
            }
            ps = PointCloudRecognizerPlus.ClassifyScore(candidate, gestureSet);
            break;

        case ClassifierClass.QPointCloud:
            if (showDebugMsg)
            {
                Debug.Log("Quick cloud");
            }
            ps = QPointCloudRecognizer.ClassifyScore(candidate, gestureSet);
            break;

        default:
            throw new System.Exception("No such class!");
        }

        if (ps.score > maxDistance)
        {
            return(null);
        }

        return(ps);
    }