public void RecognizerJudge(List <Vector3> vecList) { // Shift all points to positive quadrant if (makePositive) { vecList = PositiveQ(vecList); } ps = ClassifierScript.ClassifyScore(vecList); if (ps == null) { if (showDebugMsg) { Debug.Log("Recognizer does not detect"); } CheckMonsters2(DrawingManager.LineType.nothing.ToString()); } else { if (showDebugMsg) { Debug.Log("Recognizer detected: " + ps.templateName); } CheckMonsters2(ps.templateName); } }
private void Update() { if (Input.GetMouseButtonDown(0)) { isValidStart = false; RaycastHit2D[] raycastHit2D = null; raycastHit2D = Physics2D.RaycastAll(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero); foreach (RaycastHit2D ray2D in raycastHit2D) { if (ray2D == startArea) { isValidStart = true; break; } } if (isValidStart) { ClearScreen(); } } if (Input.GetMouseButton(0) && isValidStart) { Vector3 _point = Camera.main.ScreenToWorldPoint(Input.mousePosition); _point.z = 0f; gesturePoints.Add(_point); gestureRenderer.positionCount = gesturePoints.Count; gestureRenderer.SetPosition(gesturePoints.Count - 1, _point); } if (Input.GetMouseButtonUp(0)) { PassStuff ps = ClassifierScript.ClassifyScore(gesturePoints); if (ps == null) { string msg = "Does not detect anything"; Debug.Log(msg); statusText.text = msg; } else { string msg = "Detected: " + ps.templateName; Debug.Log(msg); statusText.text = msg; } } }
public void TryRecognize() { PassStuff ps = ClassifierScript.ClassifyScore(gesturePoints); if (ps == null) { string msg = "Does not detect anything"; Debug.Log(msg); statusText.text = msg; } else { string msg = "Detected: " + ps.templateName; Debug.Log(msg); statusText.text = msg; } }
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); }