Search in sources :

Example 6 with S3Object

use of com.amazonaws.services.rekognition.model.S3Object in project aws-doc-sdk-examples by awsdocs.

the class VideoDetect method StartFaceSearchCollection.

// Started face collection search in a video by calling StartFaceSearch.
// bucket is the S3 bucket that contains the video.
// video is the video filename.
// Change CollectionId to the ID of the collection that you want to search
private static void StartFaceSearchCollection(String bucket, String video) throws Exception {
    StartFaceSearchRequest req = new StartFaceSearchRequest().withCollectionId("CollectionId").withVideo(new Video().withS3Object(new S3Object().withBucket(bucket).withName(video))).withNotificationChannel(channel);
    StartFaceSearchResult startPersonCollectionSearchResult = rek.startFaceSearch(req);
    startJobId = startPersonCollectionSearchResult.getJobId();
}
Also used : StartFaceSearchResult(com.amazonaws.services.rekognition.model.StartFaceSearchResult) Video(com.amazonaws.services.rekognition.model.Video) StartFaceSearchRequest(com.amazonaws.services.rekognition.model.StartFaceSearchRequest) S3Object(com.amazonaws.services.rekognition.model.S3Object)

Example 7 with S3Object

use of com.amazonaws.services.rekognition.model.S3Object in project aws-doc-sdk-examples by awsdocs.

the class DetectModerationLabels method main.

public static void main(String[] args) throws Exception {
    // Change the values of photo and bucket to your values.
    String photo = "input.jpg";
    String bucket = "bucket";
    AmazonRekognition rekognitionClient = AmazonRekognitionClientBuilder.defaultClient();
    DetectModerationLabelsRequest request = new DetectModerationLabelsRequest().withImage(new Image().withS3Object(new S3Object().withName(photo).withBucket(bucket))).withMinConfidence(60F);
    try {
        DetectModerationLabelsResult result = rekognitionClient.detectModerationLabels(request);
        List<ModerationLabel> labels = result.getModerationLabels();
        System.out.println("Detected labels for " + photo);
        for (ModerationLabel label : labels) {
            System.out.println("Label: " + label.getName() + "\n Confidence: " + label.getConfidence().toString() + "%" + "\n Parent:" + label.getParentName());
        }
    } catch (AmazonRekognitionException e) {
        e.printStackTrace();
    }
}
Also used : ModerationLabel(com.amazonaws.services.rekognition.model.ModerationLabel) AmazonRekognitionException(com.amazonaws.services.rekognition.model.AmazonRekognitionException) AmazonRekognition(com.amazonaws.services.rekognition.AmazonRekognition) S3Object(com.amazonaws.services.rekognition.model.S3Object) Image(com.amazonaws.services.rekognition.model.Image) DetectModerationLabelsResult(com.amazonaws.services.rekognition.model.DetectModerationLabelsResult) DetectModerationLabelsRequest(com.amazonaws.services.rekognition.model.DetectModerationLabelsRequest)

Example 8 with S3Object

use of com.amazonaws.services.rekognition.model.S3Object in project aws-doc-sdk-examples by awsdocs.

the class VideoDetect method StartModerationLabels.

// Starts the moderation of content in a video by calling StartContentModeration.
// bucket is the S3 bucket that contains the video.
// video is the video filename.
// ==================================================================
private static void StartModerationLabels(String bucket, String video) throws Exception {
    StartContentModerationRequest req = new StartContentModerationRequest().withVideo(new Video().withS3Object(new S3Object().withBucket(bucket).withName(video))).withNotificationChannel(channel);
    StartContentModerationResult startModerationLabelDetectionResult = rek.startContentModeration(req);
    startJobId = startModerationLabelDetectionResult.getJobId();
}
Also used : StartContentModerationRequest(com.amazonaws.services.rekognition.model.StartContentModerationRequest) Video(com.amazonaws.services.rekognition.model.Video) StartContentModerationResult(com.amazonaws.services.rekognition.model.StartContentModerationResult) S3Object(com.amazonaws.services.rekognition.model.S3Object)

Example 9 with S3Object

use of com.amazonaws.services.rekognition.model.S3Object in project aws-doc-sdk-examples by awsdocs.

the class VideoDetect method StartCelebrities.

// Starts the detection of celebrities in a video by calling StartCelebrityRecognition.
// bucket is the S3 bucket that contains the video.
// video is the video filename.
private static void StartCelebrities(String bucket, String video) throws Exception {
    StartCelebrityRecognitionRequest req = new StartCelebrityRecognitionRequest().withVideo(new Video().withS3Object(new S3Object().withBucket(bucket).withName(video))).withNotificationChannel(channel);
    StartCelebrityRecognitionResult startCelebrityRecognitionResult = rek.startCelebrityRecognition(req);
    startJobId = startCelebrityRecognitionResult.getJobId();
}
Also used : Video(com.amazonaws.services.rekognition.model.Video) S3Object(com.amazonaws.services.rekognition.model.S3Object) StartCelebrityRecognitionRequest(com.amazonaws.services.rekognition.model.StartCelebrityRecognitionRequest) StartCelebrityRecognitionResult(com.amazonaws.services.rekognition.model.StartCelebrityRecognitionResult)

Example 10 with S3Object

use of com.amazonaws.services.rekognition.model.S3Object in project aws-doc-sdk-examples by awsdocs.

the class VideoDetect method StartFaces.

// Starts face detection in a stored video by calling StartFaceDetection.
// bucket is the S3 bucket that contains the video.
// video is the video filename.
private static void StartFaces(String bucket, String video) throws Exception {
    StartFaceDetectionRequest req = new StartFaceDetectionRequest().withVideo(new Video().withS3Object(new S3Object().withBucket(bucket).withName(video))).withNotificationChannel(channel);
    StartFaceDetectionResult startLabelDetectionResult = rek.startFaceDetection(req);
    startJobId = startLabelDetectionResult.getJobId();
}
Also used : StartFaceDetectionRequest(com.amazonaws.services.rekognition.model.StartFaceDetectionRequest) Video(com.amazonaws.services.rekognition.model.Video) S3Object(com.amazonaws.services.rekognition.model.S3Object) StartFaceDetectionResult(com.amazonaws.services.rekognition.model.StartFaceDetectionResult)

Aggregations

S3Object (com.amazonaws.services.rekognition.model.S3Object)13 AmazonRekognition (com.amazonaws.services.rekognition.AmazonRekognition)7 Image (com.amazonaws.services.rekognition.model.Image)7 Video (com.amazonaws.services.rekognition.model.Video)6 AmazonRekognitionException (com.amazonaws.services.rekognition.model.AmazonRekognitionException)4 DetectFacesRequest (com.amazonaws.services.rekognition.model.DetectFacesRequest)2 DetectFacesResult (com.amazonaws.services.rekognition.model.DetectFacesResult)2 FaceDetail (com.amazonaws.services.rekognition.model.FaceDetail)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 AgeRange (com.amazonaws.services.rekognition.model.AgeRange)1 BoundingBox (com.amazonaws.services.rekognition.model.BoundingBox)1 DetectLabelsRequest (com.amazonaws.services.rekognition.model.DetectLabelsRequest)1 DetectLabelsResult (com.amazonaws.services.rekognition.model.DetectLabelsResult)1 DetectModerationLabelsRequest (com.amazonaws.services.rekognition.model.DetectModerationLabelsRequest)1 DetectModerationLabelsResult (com.amazonaws.services.rekognition.model.DetectModerationLabelsResult)1 DetectTextRequest (com.amazonaws.services.rekognition.model.DetectTextRequest)1 DetectTextResult (com.amazonaws.services.rekognition.model.DetectTextResult)1 FaceMatch (com.amazonaws.services.rekognition.model.FaceMatch)1 FaceRecord (com.amazonaws.services.rekognition.model.FaceRecord)1 IndexFacesRequest (com.amazonaws.services.rekognition.model.IndexFacesRequest)1