Last active
March 22, 2018 22:38
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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