Skip to content

Instantly share code, notes, and snippets.

@juucustodio
Last active March 22, 2018 22:38
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/877eea84f83c9da05d00421283da51d7 to your computer and use it in GitHub Desktop.
Save juucustodio/877eea84f83c9da05d00421283da51d7 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
public async void FaceVerify(object sender, EventArgs e)
{
if (faceId1 == new Guid())
await FaceAddInPerson(filePath1);
// Call the Face API.
try
{
var result = await _faceServiceClient.VerifyAsync(faceId2,"grupo",personId);
await DisplayAlert("Result",
"IsIdentical: " + result.IsIdentical +
" Confidence: " + result.Confidence,
"OK");
await _faceServiceClient.DeletePersonFaceAsync("grupo", personId, faceId1);
faceId1 = new Guid();
}
// Catch and display Face API errors.
catch (FaceAPIException f)
{
await DisplayAlert("Error", f.ErrorMessage, "ok");
}
// Catch and display all other errors.
catch (Exception ex)
{
await DisplayAlert("Error", ex.Message, "ok");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment