devxlogo

October 9, 2019

Extract Faces Using Amazon Rekognition

AmazonRekognitionClient amazonRekognitionClient = new AmazonRekognitionClient(Amazon.RegionEndpoint.);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 themif (facesResponse.FaceDetails.Count > 0){foreach (var