/// <summary> /// Performs asynchronous video annotation. Progress and results can be /// retrieved through the `google.longrunning.Operations` interface. /// `Operation.metadata` contains `AnnotateVideoProgress` (progress). /// `Operation.response` contains `AnnotateVideoResponse` (results). /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <lro::Operation <AnnotateVideoResponse, AnnotateVideoProgress> > AnnotateVideoAsync(AnnotateVideoRequest request, st::CancellationToken cancellationToken) => AnnotateVideoAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
partial void Modify_AnnotateVideoRequest(ref AnnotateVideoRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Performs asynchronous video annotation. Progress and results can be /// retrieved through the `google.longrunning.Operations` interface. /// `Operation.metadata` contains `AnnotateVideoProgress` (progress). /// `Operation.response` contains `AnnotateVideoResponse` (results). /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <lro::Operation <AnnotateVideoResponse, AnnotateVideoProgress> > AnnotateVideoAsync(AnnotateVideoRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();
/// <summary> /// Performs asynchronous video annotation. Progress and results can be /// retrieved through the `google.longrunning.Operations` interface. /// `Operation.metadata` contains `AnnotateVideoProgress` (progress). /// `Operation.response` contains `AnnotateVideoResponse` (results). /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public override async stt::Task <lro::Operation <AnnotateVideoResponse, AnnotateVideoProgress> > AnnotateVideoAsync(AnnotateVideoRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_AnnotateVideoRequest(ref request, ref callSettings); return(new lro::Operation <AnnotateVideoResponse, AnnotateVideoProgress>(await _callAnnotateVideo.Async(request, callSettings).ConfigureAwait(false), AnnotateVideoOperationsClient)); }
/// <summary> /// Performs asynchronous video annotation. Progress and results can be /// retrieved through the `google.longrunning.Operations` interface. /// `Operation.metadata` contains `AnnotateVideoProgress` (progress). /// `Operation.response` contains `AnnotateVideoResponse` (results). /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public override lro::Operation <AnnotateVideoResponse, AnnotateVideoProgress> AnnotateVideo(AnnotateVideoRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_AnnotateVideoRequest(ref request, ref callSettings); return(new lro::Operation <AnnotateVideoResponse, AnnotateVideoProgress>(_callAnnotateVideo.Sync(request, callSettings), AnnotateVideoOperationsClient)); }
/// <summary> /// Performs asynchronous video annotation. Progress and results can be /// retrieved through the `google.longrunning.Operations` interface. /// `Operation.metadata` contains `AnnotateVideoProgress` (progress). /// `Operation.response` contains `AnnotateVideoResponse` (results). /// </summary> /// <param name="request"> /// The request object containing all of the parameters for the API call. /// </param> /// <param name="callSettings"> /// If not null, applies overrides to this RPC call. /// </param> /// <returns> /// The RPC response. /// </returns> public virtual lro::Operation <AnnotateVideoResponse, AnnotateVideoProgress> AnnotateVideo( AnnotateVideoRequest request, gaxgrpc::CallSettings callSettings = null) { throw new s::NotImplementedException(); }
// [END video_detect_logo] // [START video_detect_logo_gcs] public static object DetectLogoGcs(string gcsUri) { var client = VideoIntelligenceServiceClient.Create(); var request = new AnnotateVideoRequest() { InputUri = gcsUri, Features = { Feature.LogoRecognition } }; Console.WriteLine("\nWaiting for operation to complete..."); var op = client.AnnotateVideo(request).PollUntilCompleted(); // The first result is retrieved because a single video was processed. var annotationResults = op.Result.AnnotationResults[0]; // Annotations for list of logos detected, tracked and recognized in video. foreach (var logoRecognitionAnnotation in annotationResults.LogoRecognitionAnnotations) { var entity = logoRecognitionAnnotation.Entity; // Opaque entity ID. Some IDs may be available in // [Google Knowledge Graph Search API](https://developers.google.com/knowledge-graph/). Console.WriteLine($"Entity ID :{entity.EntityId}"); Console.WriteLine($"Description :{entity.Description}"); // All logo tracks where the recognized logo appears. Each track corresponds to one logo // instance appearing in consecutive frames. foreach (var track in logoRecognitionAnnotation.Tracks) { // Video segment of a track. var startTimeOffset = track.Segment.StartTimeOffset; Console.WriteLine( $"Start Time Offset: {startTimeOffset.Seconds}.{startTimeOffset.Nanos}"); var endTimeOffset = track.Segment.EndTimeOffset; Console.WriteLine( $"End Time Offset: {endTimeOffset.Seconds}.{endTimeOffset.Seconds}"); Console.WriteLine($"\tConfidence: {track.Confidence}"); // The object with timestamp and attributes per frame in the track. foreach (var timestampedObject in track.TimestampedObjects) { // Normalized Bounding box in a frame, where the object is located. var normalizedBoundingBox = timestampedObject.NormalizedBoundingBox; Console.WriteLine($"Left: {normalizedBoundingBox.Left}"); Console.WriteLine($"Top: {normalizedBoundingBox.Top}"); Console.WriteLine($"Right: {normalizedBoundingBox.Right}"); Console.WriteLine($"Bottom: {normalizedBoundingBox.Bottom}"); // Optional. The attributes of the object in the bounding box. foreach (var attribute in timestampedObject.Attributes) { Console.WriteLine($"Name: {attribute.Name}"); Console.WriteLine($"Confidence: {attribute.Confidence}"); Console.WriteLine($"Value: {attribute.Value}"); } // Optional. Attributes in the track level. foreach (var trackAttribute in track.Attributes) { Console.WriteLine($"Name : {trackAttribute.Name}"); Console.WriteLine($"Confidence : {trackAttribute.Confidence}"); Console.WriteLine($"Value : {trackAttribute.Value}"); } } // All video segments where the recognized logo appears. There might be multiple instances // of the same logo class appearing in one VideoSegment. foreach (var segment in logoRecognitionAnnotation.Segments) { Console.WriteLine( $"Start Time Offset : {segment.StartTimeOffset.Seconds}.{segment.StartTimeOffset.Nanos}"); Console.WriteLine( $"End Time Offset : {segment.EndTimeOffset.Seconds}.{segment.EndTimeOffset.Nanos}"); } } } return(0); }