Skip to content

Instantly share code, notes, and snippets.

@juucustodio
Last active March 22, 2018 22:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juucustodio/e833c689d3aacb313180e15c8b3721b9 to your computer and use it in GitHub Desktop.
Save juucustodio/e833c689d3aacb313180e15c8b3721b9 to your computer and use it in GitHub Desktop.
This example show how to building a Xamarin.Forms applications using Microsoft Cognitive Services to identify if two pictures are from same person - http://julianocustodio.com/face-verify
private async Task FaceAddInPerson(string image)
{
// Call the Face API.
try
{
using (Stream imageFileStream = File.OpenRead(image))
{
var result = await _faceServiceClient.AddPersonFaceAsync("grupo",personId, imageFileStream);
faceId1 = result.PersistedFaceId;
}
await _faceServiceClient.TrainPersonGroupAsync("grupo");
}
// Catch and display Face API errors.
catch (FaceAPIException f)
{
await DisplayAlert("Error", f.ErrorMessage, "ok");
}
// Catch and display all other errors.
catch (Exception e)
{
await DisplayAlert("Error", e.Message, "ok");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment