IEnumerator Send_Image_To_Server() { float Start_Time = Time.time; WWW localFile = new WWW(file_path); yield return(localFile); WWWForm postForm = new WWWForm(); postForm.AddBinaryData("myfile", localFile.bytes, "mini_bus.jpg"); WWW upload = new WWW(Server_Address, postForm); yield return(upload); if (upload.error == null) { Result_Text = upload.text; Identify_Result = Result_Text_Analysis(Result_Text); GetComponent <Show_Identify_Result>().Get_Result_Signal(Identify_Result, Highest_Percentage); compo_Audio.PlayOneShot(result_On_Sound); //data_Path = Application.persistentDataPath; Debug.Log(upload.text); //결과로 나온 php 페이지 값을 출력해준다. 해당 php 파일의 결과 값은 단어 하나로 출력된다. ex) ship } else { Debug.Log("Error during upload: " + upload.error); } Taken_Time = Time.time - Start_Time; is_Identifying = false; Loading_Effect_Obj.SetActive(false); Debug.Log("From Drawing CNN _Time : " + Taken_Time); }
void Image_Upload() { if (!is_Identifying) { if (!False_Identification_On) { Debug.Log("From Drawing Send Image_To_Server"); is_Identifying = true; Loading_Effect_Obj.SetActive(true); Render_Image_To_File(); StartCoroutine(Send_Image_To_Server()); compo_Audio.PlayOneShot(button_Sound); } else { Debug.Log("From Drawing Send 이미지 인식은 더 이상 지원하지 않습니다"); is_Identifying = true; Loading_Effect_Obj.SetActive(true); Render_Image_To_File(); StartCoroutine(False_Identification()); compo_Audio.PlayOneShot(button_Sound); } } }
IEnumerator False_Identification() { yield return(new WaitForSeconds(3.0f)); GetComponent <Show_Identify_Result>().Get_Result_Signal("서비스 불가", 0); Highest_Percentage = Random.Range(0.50f, 1.00f); is_Identifying = false; Loading_Effect_Obj.SetActive(false); }
private void Start() { //line = GetComponent<LineRenderer>(); GameObject player_Check = GameObject.FindGameObjectWithTag("player"); compo_Audio = GetComponent <AudioSource>(); Loading_Effect_Obj.SetActive(false); script_pShot = player_Check.GetComponent <player_shot>(); string tmp_char = "" + (char)92; string tmp = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments); file_path = "file://" + tmp.Replace(tmp_char, "//") + "//Drawing_Capture.jpg"; }