Extract Faces Using Amazon Rekognition

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 face in facesResponse.FaceDetails){//save them to bitmap by cropping with bounds of the face object}}

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist