Reputation: 119
I am using Azure Cognitive Service Face to develop an Android App to detect faces.
I am trying to reproduce the result in https://learn.microsoft.com/en-us/azure/cognitive-services/face/tutorials/faceapiinjavaforandroidtutorial
I am coding with Java in Android Studio.
I am using a picture from the drawable folder and convert it to bitmap using:
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.test_image);
I made sure that the bitmap is working properly by showing it in another imageView imgV.setImageBitmap(bitmap);
The image is shown properly in the imageView.
Then I call detectAndFrame(bitmap)
.
In the line Face[] result = faceServiceClient.detect(params[0],true,false,null);
I got the exception Resource not found.
I am wondering where the problem is. Thank you very much!
Upvotes: 1
Views: 178
Reputation: 119
I found the solution. It turns out to be the endpoint URL issue.
For JAVA in Android Studio, use: https://LOCATION_SPECIFIED_WHEN_CREATING_THE_RESOURCE.api.cognitive.microsoft.com/face/v1.0/
For example, if you chose west US 2 when generating the face resource, use the endpoint as:
https://westus2.api.cognitive.microsoft.com/face/v1.0/
If a wrong endpoint is given, it is possible that you will get an exception called "Resource not found" when calling a function from the client.
Also, do not forget to add the closing slash in the endpoint address!
Hope that helps.
Upvotes: 1