Search in sources :

Example 1 with ListFacesRequest

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);
    }
}
Also used : RekognitionException(software.amazon.awssdk.services.rekognition.model.RekognitionException) ListFacesResponse(software.amazon.awssdk.services.rekognition.model.ListFacesResponse) ListFacesRequest(software.amazon.awssdk.services.rekognition.model.ListFacesRequest) Face(software.amazon.awssdk.services.rekognition.model.Face)

Aggregations

Face (software.amazon.awssdk.services.rekognition.model.Face)1 ListFacesRequest (software.amazon.awssdk.services.rekognition.model.ListFacesRequest)1 ListFacesResponse (software.amazon.awssdk.services.rekognition.model.ListFacesResponse)1 RekognitionException (software.amazon.awssdk.services.rekognition.model.RekognitionException)1