Exemple #1
0
    private void GestureRecognitionInternal()
    {
        _lastTime = Time.time;
        if (_errorCount >= MAX_ERROR_COUNT)
        {
            if (gestureRecognitionHandler != null)
            {
                gestureRecognitionHandler(false, null);
            }
            StopCoroutine("TimeoutCoroutine");
            return;
        }

        Debug.LogFormat("第{0}次识别...", _errorCount + 1);
        //Register();
#if UNITY_EDITOR
        Debug.Log(ResUtil.GetSandBoxPath("1.png"));
        byte[] bytes = ResUtil.GetBytesFromLocal("1.png");
        ImageRecognition(bytes);
#else
        //GetARCameraImageAsync();
        GetImageAsync();
#endif
        //yield return new WaitForEndOfFrame();//拍照需要
        //byte[] bytes = PhotoGraphBytes();
        //byte[] bytes = GetARCameraImage();
        //if (bytes == null)
        //{
        //    yield return null;
        //    continue;
        //}

        //string result = com.baidu.ai.Gesture.gesture(tokenJson.access_token, bytes);
        //GestureJson gestureJson = JsonUtility.FromJson<GestureJson>(result);

        //Debug.Log("result:" + result);
        //if (gestureJson.result != null && gestureJson.result.Count > 0)
        //{
        //    foreach (var kvp in gestureJson.result)
        //    {
        //        string r = com.baidu.ai.Gesture.GetDescription(kvp.classname);
        //        Debug.Log(kvp.classname + "   " + r);
        //        if (!string.IsNullOrEmpty(r))
        //        {
        //            i = errorNum;
        //            StopCoroutine("GestureRecognitionCoroutine");
        //            if (gestureRecognitionHandler != null)
        //                gestureRecognitionHandler(true, r);
        //        }
        //    }
        //}
        //UnRegister();
    }
Exemple #2
0
    //拍照截图
    public string PhotoGraph(string fileName)
    {
        string subPath = CameraPhotoGraph.SaveRenderTextureToPNG(fileName);

        return(ResUtil.GetSandBoxPath(subPath));
    }