Search in sources :

Example 31 with RekognitionException

use of software.amazon.awssdk.services.rekognition.model.RekognitionException in project aws-doc-sdk-examples by awsdocs.

the class CelebrityInfo method getCelebrityInfo.

// snippet-start:[rekognition.java2.celebrityInfo.main]
public static void getCelebrityInfo(RekognitionClient rekClient, String id) {
    try {
        GetCelebrityInfoRequest info = GetCelebrityInfoRequest.builder().id(id).build();
        GetCelebrityInfoResponse response = rekClient.getCelebrityInfo(info);
        // Display celebrity information.
        System.out.println("celebrity name: " + response.name());
        System.out.println("Further information (if available):");
        for (String url : response.urls()) {
            System.out.println(url);
        }
    } catch (RekognitionException e) {
        System.out.println(e.getMessage());
        System.exit(1);
    }
}
Also used : GetCelebrityInfoRequest(software.amazon.awssdk.services.rekognition.model.GetCelebrityInfoRequest) GetCelebrityInfoResponse(software.amazon.awssdk.services.rekognition.model.GetCelebrityInfoResponse) RekognitionException(software.amazon.awssdk.services.rekognition.model.RekognitionException)

Example 32 with RekognitionException

use of software.amazon.awssdk.services.rekognition.model.RekognitionException in project aws-doc-sdk-examples by awsdocs.

the class CreateCollection method createMyCollection.

// snippet-start:[rekognition.java2.create_collection.main]
public static void createMyCollection(RekognitionClient rekClient, String collectionId) {
    try {
        CreateCollectionRequest collectionRequest = CreateCollectionRequest.builder().collectionId(collectionId).build();
        CreateCollectionResponse collectionResponse = rekClient.createCollection(collectionRequest);
        System.out.println("CollectionArn : " + collectionResponse.collectionArn());
        System.out.println("Status code : " + collectionResponse.statusCode().toString());
    } catch (RekognitionException e) {
        System.out.println(e.getMessage());
        System.exit(1);
    }
}
Also used : CreateCollectionRequest(software.amazon.awssdk.services.rekognition.model.CreateCollectionRequest) RekognitionException(software.amazon.awssdk.services.rekognition.model.RekognitionException) CreateCollectionResponse(software.amazon.awssdk.services.rekognition.model.CreateCollectionResponse)

Example 33 with RekognitionException

use of software.amazon.awssdk.services.rekognition.model.RekognitionException in project aws-doc-sdk-examples by awsdocs.

the class DeleteCollection method deleteMyCollection.

// snippet-start:[rekognition.java2.delete_collection.main]
public static void deleteMyCollection(RekognitionClient rekClient, String collectionId) {
    try {
        DeleteCollectionRequest deleteCollectionRequest = DeleteCollectionRequest.builder().collectionId(collectionId).build();
        DeleteCollectionResponse deleteCollectionResponse = rekClient.deleteCollection(deleteCollectionRequest);
        System.out.println(collectionId + ": " + deleteCollectionResponse.statusCode().toString());
    } catch (RekognitionException e) {
        System.out.println(e.getMessage());
        System.exit(1);
    }
}
Also used : DeleteCollectionRequest(software.amazon.awssdk.services.rekognition.model.DeleteCollectionRequest) RekognitionException(software.amazon.awssdk.services.rekognition.model.RekognitionException) DeleteCollectionResponse(software.amazon.awssdk.services.rekognition.model.DeleteCollectionResponse)

Aggregations

RekognitionException (software.amazon.awssdk.services.rekognition.model.RekognitionException)33 Image (software.amazon.awssdk.services.rekognition.model.Image)12 SdkBytes (software.amazon.awssdk.core.SdkBytes)10 FileInputStream (java.io.FileInputStream)8 FileNotFoundException (java.io.FileNotFoundException)8 InputStream (java.io.InputStream)8 S3Object (software.amazon.awssdk.services.rekognition.model.S3Object)8 Video (software.amazon.awssdk.services.rekognition.model.Video)6 VideoMetadata (software.amazon.awssdk.services.rekognition.model.VideoMetadata)6 File (java.io.File)2 Celebrity (software.amazon.awssdk.services.rekognition.model.Celebrity)2 ComparedFace (software.amazon.awssdk.services.rekognition.model.ComparedFace)2 DetectLabelsRequest (software.amazon.awssdk.services.rekognition.model.DetectLabelsRequest)2 DetectLabelsResponse (software.amazon.awssdk.services.rekognition.model.DetectLabelsResponse)2 FaceMatch (software.amazon.awssdk.services.rekognition.model.FaceMatch)2 Label (software.amazon.awssdk.services.rekognition.model.Label)2 RecognizeCelebritiesRequest (software.amazon.awssdk.services.rekognition.model.RecognizeCelebritiesRequest)2 RecognizeCelebritiesResponse (software.amazon.awssdk.services.rekognition.model.RecognizeCelebritiesResponse)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 JsonMappingException (com.fasterxml.jackson.databind.JsonMappingException)1