dcsimg
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Tip: Extract Faces Using Amazon Rekognition

Learn how to detect and extract faces with Amazon Rekognition.


advertisement

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


AmazonRekognitionClient amazonRekognitionClient = new AmazonRekognitionClient(Amazon.RegionEndpoint.<YourRegionName>);


byte[] imageData = System.IO.File.ReadAllBytes(inputImageFile);

DetectFacesRequest facesRequest = new DetectFacesRequest();


facesRequest.Image = new Amazon.Rekognition.Model.Image
{
Bytes = new MemoryStream(imageData)
};

DetectFacesResponse facesResponse = amazonRekognitionClient.DetectFaces(facesRequest);

//If faces are detected, extract them
if (facesResponse.FaceDetails.Count > 0)
{
foreach (var face in facesResponse.FaceDetails)
{
//save them to bitmap by cropping with bounds of the face object
}
}


   
Srinath M. S. says: "I would love to leave a footprint in this flat world."
Thanks for your registration, follow us on our social networks to keep up-to-date