use of software.amazon.awssdk.services.rekognition.model.ListFacesRequest in project aws-doc-sdk-examples by awsdocs.
the class ListFacesInCollection method listFacesCollection.
// snippet-start:[rekognition.java2.list_faces_collection.main]
public static void listFacesCollection(RekognitionClient rekClient, String collectionId) {
try {
ListFacesRequest facesRequest = ListFacesRequest.builder().collectionId(collectionId).maxResults(10).build();
ListFacesResponse facesResponse = rekClient.listFaces(facesRequest);
// For each face in the collection, print out the confidence level and face id value.
List<Face> faces = facesResponse.faces();
for (Face face : faces) {
System.out.println("Confidence level there is a face: " + face.confidence());
System.out.println("The face Id value is " + face.faceId());
}
} catch (RekognitionException e) {
System.out.println(e.getMessage());
System.exit(1);
}
}
Aggregations