Search in sources :

Example 11 with S3Object

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

the class VideoDetect method StartPersons.

// Starts the tracking of people in a video by calling StartPersonTracking
// bucket is the S3 bucket that contains the video.
// video is the video filename.
private static void StartPersons(String bucket, String video) throws Exception {
    int maxResults = 10;
    String paginationToken = null;
    StartPersonTrackingRequest req = new StartPersonTrackingRequest().withVideo(new Video().withS3Object(new S3Object().withBucket(bucket).withName(video))).withNotificationChannel(channel);
    StartPersonTrackingResult startPersonDetectionResult = rek.startPersonTracking(req);
    startJobId = startPersonDetectionResult.getJobId();
}
Also used : Video(com.amazonaws.services.rekognition.model.Video) StartPersonTrackingRequest(com.amazonaws.services.rekognition.model.StartPersonTrackingRequest) S3Object(com.amazonaws.services.rekognition.model.S3Object) StartPersonTrackingResult(com.amazonaws.services.rekognition.model.StartPersonTrackingResult)

Example 12 with S3Object

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

the class VideoDetect method StartLabels.

// Starts label detection by calling StartLabelDetection.
// bucket is the S3 bucket that contains the video.
// video is the video filename.
private static void StartLabels(String bucket, String video) throws Exception {
    StartLabelDetectionRequest req = new StartLabelDetectionRequest().withVideo(new Video().withS3Object(new S3Object().withBucket(bucket).withName(video))).withMinConfidence(50F).withJobTag("DetectingLabels").withNotificationChannel(channel);
    StartLabelDetectionResult startLabelDetectionResult = rek.startLabelDetection(req);
    startJobId = startLabelDetectionResult.getJobId();
}
Also used : StartLabelDetectionResult(com.amazonaws.services.rekognition.model.StartLabelDetectionResult) Video(com.amazonaws.services.rekognition.model.Video) StartLabelDetectionRequest(com.amazonaws.services.rekognition.model.StartLabelDetectionRequest) S3Object(com.amazonaws.services.rekognition.model.S3Object)

Example 13 with S3Object

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

the class AddFacesToCollection method main.

public static void main(String[] args) throws Exception {
    AmazonRekognition rekognitionClient = AmazonRekognitionClientBuilder.defaultClient();
    Image image = new Image().withS3Object(new S3Object().withBucket(bucket).withName(photo));
    IndexFacesRequest indexFacesRequest = new IndexFacesRequest().withImage(image).withQualityFilter(QualityFilter.AUTO).withMaxFaces(1).withCollectionId(collectionId).withExternalImageId(photo).withDetectionAttributes("DEFAULT");
    IndexFacesResult indexFacesResult = rekognitionClient.indexFaces(indexFacesRequest);
    System.out.println("Results for " + photo);
    System.out.println("Faces indexed:");
    List<FaceRecord> faceRecords = indexFacesResult.getFaceRecords();
    for (FaceRecord faceRecord : faceRecords) {
        System.out.println("  Face ID: " + faceRecord.getFace().getFaceId());
        System.out.println("  Location:" + faceRecord.getFaceDetail().getBoundingBox().toString());
    }
    List<UnindexedFace> unindexedFaces = indexFacesResult.getUnindexedFaces();
    System.out.println("Faces not indexed:");
    for (UnindexedFace unindexedFace : unindexedFaces) {
        System.out.println("  Location:" + unindexedFace.getFaceDetail().getBoundingBox().toString());
        System.out.println("  Reasons:");
        for (String reason : unindexedFace.getReasons()) {
            System.out.println("   " + reason);
        }
    }
}
Also used : IndexFacesResult(com.amazonaws.services.rekognition.model.IndexFacesResult) IndexFacesRequest(com.amazonaws.services.rekognition.model.IndexFacesRequest) FaceRecord(com.amazonaws.services.rekognition.model.FaceRecord) AmazonRekognition(com.amazonaws.services.rekognition.AmazonRekognition) S3Object(com.amazonaws.services.rekognition.model.S3Object) Image(com.amazonaws.services.rekognition.model.Image) UnindexedFace(com.amazonaws.services.rekognition.model.UnindexedFace)

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