Created
June 10, 2019 01:37
-
-
Save fernandoseguim/54036b163f7d1552a9ef465476dbf578 to your computer and use it in GitHub Desktop.
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
const float CONFIDENCE_LEVEL = 90; | |
var count = 0; | |
using(var source = new MemoryStream(image)) | |
{ | |
var request = new DetectFacesRequest { Image = new Image() { Bytes = source }, Attributes = new List<string> { "ALL" } }; | |
var response = await amazonRekognitionClient.DetectFacesAsync(request); | |
foreach(var faceDetail in response.FaceDetails) | |
{ | |
Console.WriteLine($"Person {++count}"); | |
Console.WriteLine(faceDetail.Gender.Confidence > CONFIDENCE_LEVEL | |
&& faceDetail.Gender.Value.Value.Equals("male", StringComparison.InvariantCultureIgnoreCase) | |
? "appears to be male" | |
: "appears to be female"); | |
Console.WriteLine(faceDetail.Smile.Confidence > CONFIDENCE_LEVEL && faceDetail.Smile.Value is true ? "smiling" : "not smiling"); | |
Console.WriteLine(faceDetail.Beard.Confidence > CONFIDENCE_LEVEL && faceDetail.Beard.Value is true ? "has a beard" : "does not have a beard"); | |
Console.WriteLine(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment