Zero faces returned from Face API when sending stream

SSB 71 Reputation points
2021-02-27T16:36:44.37+00:00

I'm trying to detect if any faces in a picture using Azure Face Api. I have a Xamarin Forms apps where a picture is taken using the camera and I want to check if there are any faces there.

The picture is taken using the Xamarin Community Toolkit CameraView and i can successfully display that in an Image. The CameraView returns both an Image and a byte[] of the image.

I have checked that the byte[] actually is containing the image by testing as such:

img_selfie.Source = ImageSource.FromStream((() => new MemoryStream(_vm.SelfieImageData)));

However, when i pass that into the Azure Face api, it always returns no faces

var faceClient = new FaceClient(new ApiKeyServiceClientCredentials(key));

faceClient.Endpoint = endpoint;

var faces = await faceClient.Face.DetectWithStreamAsync(new MemoryStream(_vm.SelfieImageData));

Please could you suggest what could be going wrong here?

Thanks!

Azure Cognitive Services
Azure Cognitive Services
A group of Azure artificial intelligence services and cognitive APIs that help build intelligent apps.
1,135 questions
Azure Face API
Azure Face API
An Azure service that provides artificial intelligence algorithms that detect, recognize, and analyze human faces in images.
111 questions
{count} votes