DetectLogoGcs { public static void detectLogoGcs(String inputUri) throws IOException, ExecutionException, InterruptedException { try (VideoIntelligenceServiceClient client = VideoIntelligenceServiceClient.create()) { AnnotateVideoRequest request = AnnotateVideoRequest.newBuilder() .setInputUri(inputUri) .addFeatures(Feature.LOGO_RECOGNITION) .build(); AnnotateVideoResponse response = client.annotateVideoAsync(request).get(); VideoAnnotationResults annotationResult = response.getAnnotationResultsList().get(0); for (LogoRecognitionAnnotation logoRecognitionAnnotation : annotationResult.getLogoRecognitionAnnotationsList()) { Entity entity = logoRecognitionAnnotation.getEntity(); System.out.printf("Entity Id: %s\n", entity.getEntityId()); System.out.printf("Description: %s\n", entity.getDescription()); for (Track track : logoRecognitionAnnotation.getTracksList()) { VideoSegment segment = track.getSegment(); Duration segmentStartTimeOffset = segment.getStartTimeOffset(); System.out.printf( "\n\tStart Time Offset: %s.%s\n", segmentStartTimeOffset.getSeconds(), segmentStartTimeOffset.getNanos()); Duration segmentEndTimeOffset = segment.getEndTimeOffset(); System.out.printf( "\tEnd Time Offset: %s.%s\n", segmentEndTimeOffset.getSeconds(), segmentEndTimeOffset.getNanos()); System.out.printf("\tConfidence: %s\n", track.getConfidence()); for (TimestampedObject timestampedObject : track.getTimestampedObjectsList()) { NormalizedBoundingBox normalizedBoundingBox = timestampedObject.getNormalizedBoundingBox(); System.out.printf("\n\t\tLeft: %s\n", normalizedBoundingBox.getLeft()); System.out.printf("\t\tTop: %s\n", normalizedBoundingBox.getTop()); System.out.printf("\t\tRight: %s\n", normalizedBoundingBox.getRight()); System.out.printf("\t\tBottom: %s\n", normalizedBoundingBox.getBottom()); for (DetectedAttribute attribute : timestampedObject.getAttributesList()) { System.out.printf("\n\t\t\tName: %s\n", attribute.getName()); System.out.printf("\t\t\tConfidence: %s\n", attribute.getConfidence()); System.out.printf("\t\t\tValue: %s\n", attribute.getValue()); } } for (DetectedAttribute trackAttribute : track.getAttributesList()) { System.out.printf("\n\t\tName : %s\n", trackAttribute.getName()); System.out.printf("\t\tConfidence : %s\n", trackAttribute.getConfidence()); System.out.printf("\t\tValue : %s\n", trackAttribute.getValue()); } } for (VideoSegment logoRecognitionAnnotationSegment : logoRecognitionAnnotation.getSegmentsList()) { Duration logoRecognitionAnnotationSegmentStartTimeOffset = logoRecognitionAnnotationSegment.getStartTimeOffset(); System.out.printf( "\n\tStart Time Offset : %s.%s\n", logoRecognitionAnnotationSegmentStartTimeOffset.getSeconds(), logoRecognitionAnnotationSegmentStartTimeOffset.getNanos()); Duration logoRecognitionAnnotationSegmentEndTimeOffset = logoRecognitionAnnotationSegment.getEndTimeOffset(); System.out.printf( "\tEnd Time Offset : %s.%s\n", logoRecognitionAnnotationSegmentEndTimeOffset.getSeconds(), logoRecognitionAnnotationSegmentEndTimeOffset.getNanos()); } } } }  void detectLogo(); static void detectLogoGcs(String inputUri);  }
@Test public void testDetectFaces() throws Exception { DetectLogoGcs.detectLogoGcs("gs: String got = bout.toString(); assertThat(got).contains("Entity Id"); }