Last active
March 22, 2018 22:22
-
-
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
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
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