Search in sources :

Example 1 with Video

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

the class VideoCelebrityDetection method StartCelebrityDetection.

// snippet-start:[rekognition.java2.recognize_video_celebrity.main]
public static void StartCelebrityDetection(RekognitionClient rekClient, NotificationChannel channel, String bucket, String video) {
    try {
        S3Object s3Obj = S3Object.builder().bucket(bucket).name(video).build();
        Video vidOb = Video.builder().s3Object(s3Obj).build();
        StartCelebrityRecognitionRequest recognitionRequest = StartCelebrityRecognitionRequest.builder().jobTag("Celebrities").notificationChannel(channel).video(vidOb).build();
        StartCelebrityRecognitionResponse startCelebrityRecognitionResult = rekClient.startCelebrityRecognition(recognitionRequest);
        startJobId = startCelebrityRecognitionResult.jobId();
    } catch (RekognitionException e) {
        System.out.println(e.getMessage());
        System.exit(1);
    }
}
Also used : RekognitionException(software.amazon.awssdk.services.rekognition.model.RekognitionException) Video(software.amazon.awssdk.services.rekognition.model.Video) StartCelebrityRecognitionResponse(software.amazon.awssdk.services.rekognition.model.StartCelebrityRecognitionResponse) S3Object(software.amazon.awssdk.services.rekognition.model.S3Object) StartCelebrityRecognitionRequest(software.amazon.awssdk.services.rekognition.model.StartCelebrityRecognitionRequest)

Example 2 with Video

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

the class VideoDetect method startLabels.

// snippet-start:[rekognition.java2.recognize_video_detect.main]
public static void startLabels(RekognitionClient rekClient, NotificationChannel channel, String bucket, String video) {
    try {
        S3Object s3Obj = S3Object.builder().bucket(bucket).name(video).build();
        Video vidOb = Video.builder().s3Object(s3Obj).build();
        StartLabelDetectionRequest labelDetectionRequest = StartLabelDetectionRequest.builder().jobTag("DetectingLabels").notificationChannel(channel).video(vidOb).minConfidence(50F).build();
        StartLabelDetectionResponse labelDetectionResponse = rekClient.startLabelDetection(labelDetectionRequest);
        startJobId = labelDetectionResponse.jobId();
        boolean ans = true;
        String status = "";
        int yy = 0;
        while (ans) {
            GetLabelDetectionRequest detectionRequest = GetLabelDetectionRequest.builder().jobId(startJobId).maxResults(10).build();
            GetLabelDetectionResponse result = rekClient.getLabelDetection(detectionRequest);
            status = result.jobStatusAsString();
            if (status.compareTo("SUCCEEDED") == 0)
                ans = false;
            else
                System.out.println(yy + " status is: " + status);
            Thread.sleep(1000);
            yy++;
        }
        System.out.println(startJobId + " status is: " + status);
    } catch (RekognitionException | InterruptedException e) {
        e.getMessage();
        System.exit(1);
    }
}
Also used : GetLabelDetectionResponse(software.amazon.awssdk.services.rekognition.model.GetLabelDetectionResponse) RekognitionException(software.amazon.awssdk.services.rekognition.model.RekognitionException) Video(software.amazon.awssdk.services.rekognition.model.Video) GetLabelDetectionRequest(software.amazon.awssdk.services.rekognition.model.GetLabelDetectionRequest) StartLabelDetectionRequest(software.amazon.awssdk.services.rekognition.model.StartLabelDetectionRequest) S3Object(software.amazon.awssdk.services.rekognition.model.S3Object) StartLabelDetectionResponse(software.amazon.awssdk.services.rekognition.model.StartLabelDetectionResponse)

Example 3 with Video

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

the class VideoDetectText method startTextLabels.

// snippet-start:[rekognition.java2.recognize_video_text.main]
public static void startTextLabels(RekognitionClient rekClient, NotificationChannel channel, String bucket, String video) {
    try {
        S3Object s3Obj = S3Object.builder().bucket(bucket).name(video).build();
        Video vidOb = Video.builder().s3Object(s3Obj).build();
        StartTextDetectionRequest labelDetectionRequest = StartTextDetectionRequest.builder().jobTag("DetectingLabels").notificationChannel(channel).video(vidOb).build();
        StartTextDetectionResponse labelDetectionResponse = rekClient.startTextDetection(labelDetectionRequest);
        startJobId = labelDetectionResponse.jobId();
    } catch (RekognitionException e) {
        System.out.println(e.getMessage());
        System.exit(1);
    }
}
Also used : StartTextDetectionRequest(software.amazon.awssdk.services.rekognition.model.StartTextDetectionRequest) StartTextDetectionResponse(software.amazon.awssdk.services.rekognition.model.StartTextDetectionResponse) RekognitionException(software.amazon.awssdk.services.rekognition.model.RekognitionException) Video(software.amazon.awssdk.services.rekognition.model.Video) S3Object(software.amazon.awssdk.services.rekognition.model.S3Object)

Example 4 with Video

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

the class VideoDetectSegment method StartSegmentDetection.

// snippet-start:[rekognition.java2.recognize_video_segments.main]
public static void StartSegmentDetection(RekognitionClient rekClient, NotificationChannel channel, String bucket, String video) {
    try {
        S3Object s3Obj = S3Object.builder().bucket(bucket).name(video).build();
        Video vidOb = Video.builder().s3Object(s3Obj).build();
        StartShotDetectionFilter cueDetectionFilter = StartShotDetectionFilter.builder().minSegmentConfidence(60F).build();
        StartTechnicalCueDetectionFilter technicalCueDetectionFilter = StartTechnicalCueDetectionFilter.builder().minSegmentConfidence(60F).build();
        StartSegmentDetectionFilters filters = StartSegmentDetectionFilters.builder().shotFilter(cueDetectionFilter).technicalCueFilter(technicalCueDetectionFilter).build();
        StartSegmentDetectionRequest segDetectionRequest = StartSegmentDetectionRequest.builder().jobTag("DetectingLabels").notificationChannel(channel).segmentTypes(SegmentType.TECHNICAL_CUE, SegmentType.SHOT).video(vidOb).filters(filters).build();
        StartSegmentDetectionResponse segDetectionResponse = rekClient.startSegmentDetection(segDetectionRequest);
        startJobId = segDetectionResponse.jobId();
    } catch (RekognitionException e) {
        e.getMessage();
        System.exit(1);
    }
}
Also used : StartTechnicalCueDetectionFilter(software.amazon.awssdk.services.rekognition.model.StartTechnicalCueDetectionFilter) StartSegmentDetectionFilters(software.amazon.awssdk.services.rekognition.model.StartSegmentDetectionFilters) RekognitionException(software.amazon.awssdk.services.rekognition.model.RekognitionException) Video(software.amazon.awssdk.services.rekognition.model.Video) StartSegmentDetectionResponse(software.amazon.awssdk.services.rekognition.model.StartSegmentDetectionResponse) S3Object(software.amazon.awssdk.services.rekognition.model.S3Object) StartShotDetectionFilter(software.amazon.awssdk.services.rekognition.model.StartShotDetectionFilter) StartSegmentDetectionRequest(software.amazon.awssdk.services.rekognition.model.StartSegmentDetectionRequest)

Example 5 with Video

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

the class VideoDetectInappropriate method startModerationDetection.

// snippet-start:[rekognition.java2.recognize_video_moderation.main]
public static void startModerationDetection(RekognitionClient rekClient, NotificationChannel channel, String bucket, String video) {
    try {
        S3Object s3Obj = S3Object.builder().bucket(bucket).name(video).build();
        Video vidOb = Video.builder().s3Object(s3Obj).build();
        StartContentModerationRequest modDetectionRequest = StartContentModerationRequest.builder().jobTag("Moderation").notificationChannel(channel).video(vidOb).build();
        StartContentModerationResponse startModDetectionResult = rekClient.startContentModeration(modDetectionRequest);
        startJobId = startModDetectionResult.jobId();
    } catch (RekognitionException e) {
        System.out.println(e.getMessage());
        System.exit(1);
    }
}
Also used : StartContentModerationRequest(software.amazon.awssdk.services.rekognition.model.StartContentModerationRequest) RekognitionException(software.amazon.awssdk.services.rekognition.model.RekognitionException) Video(software.amazon.awssdk.services.rekognition.model.Video) S3Object(software.amazon.awssdk.services.rekognition.model.S3Object) StartContentModerationResponse(software.amazon.awssdk.services.rekognition.model.StartContentModerationResponse)

Aggregations

RekognitionException (software.amazon.awssdk.services.rekognition.model.RekognitionException)6 S3Object (software.amazon.awssdk.services.rekognition.model.S3Object)6 Video (software.amazon.awssdk.services.rekognition.model.Video)6 GetLabelDetectionRequest (software.amazon.awssdk.services.rekognition.model.GetLabelDetectionRequest)1 GetLabelDetectionResponse (software.amazon.awssdk.services.rekognition.model.GetLabelDetectionResponse)1 StartCelebrityRecognitionRequest (software.amazon.awssdk.services.rekognition.model.StartCelebrityRecognitionRequest)1 StartCelebrityRecognitionResponse (software.amazon.awssdk.services.rekognition.model.StartCelebrityRecognitionResponse)1 StartContentModerationRequest (software.amazon.awssdk.services.rekognition.model.StartContentModerationRequest)1 StartContentModerationResponse (software.amazon.awssdk.services.rekognition.model.StartContentModerationResponse)1 StartLabelDetectionRequest (software.amazon.awssdk.services.rekognition.model.StartLabelDetectionRequest)1 StartLabelDetectionResponse (software.amazon.awssdk.services.rekognition.model.StartLabelDetectionResponse)1 StartPersonTrackingRequest (software.amazon.awssdk.services.rekognition.model.StartPersonTrackingRequest)1 StartPersonTrackingResponse (software.amazon.awssdk.services.rekognition.model.StartPersonTrackingResponse)1 StartSegmentDetectionFilters (software.amazon.awssdk.services.rekognition.model.StartSegmentDetectionFilters)1 StartSegmentDetectionRequest (software.amazon.awssdk.services.rekognition.model.StartSegmentDetectionRequest)1 StartSegmentDetectionResponse (software.amazon.awssdk.services.rekognition.model.StartSegmentDetectionResponse)1 StartShotDetectionFilter (software.amazon.awssdk.services.rekognition.model.StartShotDetectionFilter)1 StartTechnicalCueDetectionFilter (software.amazon.awssdk.services.rekognition.model.StartTechnicalCueDetectionFilter)1 StartTextDetectionRequest (software.amazon.awssdk.services.rekognition.model.StartTextDetectionRequest)1 StartTextDetectionResponse (software.amazon.awssdk.services.rekognition.model.StartTextDetectionResponse)1