Esempio n. 1
0
    public async void OnTestPic()
    {
        if (Application.isEditor)
        {
            return;
        }
        var base64 = await Photo.SelectAsync();

        if (!string.IsNullOrEmpty(base64))
        {
            var tex       = new Texture2D(1, 1);
            var b64_bytes = System.Convert.FromBase64String(base64);
            tex.LoadImage(b64_bytes);

            var result = await HandleBase64Image(WebCamUtil.TextureToBase64(tex), tex);

            var resultPage = SimplePageManager.Instance.Show("SmileResultPage") as SmileResultPage;
            resultPage.SetInfo(MakeScore(result[0].emotion), tex, result[0].emotion);

            logBuilder.Clear();
            for (int i = 0; i < result[0].emotion.Count; i++)
            {
                logBuilder.Append(EmotionSDK.GetEmotionTypeNameByIndex(i));
                logBuilder.Append(": ");
                logBuilder.AppendLine(result[0].emotion[i].ToString());
            }
            Debug.Log(logBuilder.ToString());
        }
    }
Esempio n. 2
0
    public async void OnShoot()
    {
        for (int i = 0; i < UIObjects.Length; i++)
        {
            UIObjects[i].SetActive(false);
        }
        SmileProject.Instance.PlaySe("flash");

        Texture2D tex = null;


        if (camAvailable)
        {
            tex = ImitateUtil.Orient(backCam, backCam.videoRotationAngle, m_is_front);
            //tex = WebCamUtil.TakePictureFromCamera (SmileProject.Instance.Camera);
        }
        else
        {
            tex = DefaultPic;
        }

        m_loading             = true;
        loading_tiper.enabled = true;

        if (backCam != null)
        {
            backCam.Pause();
        }
        //SmileProject.Instance.LutifyComp.Blend = 0;


        var result = await HandleBase64Image(WebCamUtil.TextureToBase64(tex), tex);


        var resultPage = SimplePageManager.Instance.Show("SmileResultPage") as SmileResultPage;

        resultPage.SetInfo(MakeScore(result[0].emotion), tex, result[0].emotion);

        //logBuilder.Clear ();
        //for (int i = 0; i < result[0].emotion.Count; i++) {
        //    logBuilder.Append (EmotionSDK.GetEmotionTypeNameByIndex (i));
        //    logBuilder.Append ( ": " );
        //    logBuilder.AppendLine (result[0].emotion[i].ToString ());
        //}
        //Debug.Log (logBuilder.ToString ());
    }