Unity3DDetectImage.cs
string DetectImage(byte[] image, string imageUrl) | |
{ | |
string body = string.Empty; | |
using (var request = UnityWebRequest.Post(imageUrl, "")) | |
{ | |
request.SetRequestHeader("Content-Type", "application/octet-stream"); | |
request.uploadHandler = new UploadHandlerRaw(image); | |
request.SendWebRequest(); | |
while (request.isDone == false) | |
{ | |
var wfs = new WaitForSeconds(1); | |
} | |
if (request.isNetworkError || request.isHttpError) | |
{ | |
Debug.Log(request.error); | |
} | |
else | |
{ | |
body = request.downloadHandler.text; | |
} | |
} | |
return body; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment