Class ImageAnnotatorClient (2.3.0)

public abstract class ImageAnnotatorClient

ImageAnnotator client wrapper, for convenient use.

Inheritance

Object > ImageAnnotatorClient

Derived Types

Namespace

Google.Cloud.Vision.V1

Assembly

Google.Cloud.Vision.V1.dll

Remarks

Service that performs Google Cloud Vision API detection tasks over client images, such as face, landmark, logo, label, and text detection. The ImageAnnotator service returns detected entities from the images.

Properties

AsyncBatchAnnotateFilesOperationsClient

public virtual OperationsClient AsyncBatchAnnotateFilesOperationsClient { get; }

The long-running operations client for AsyncBatchAnnotateFiles.

Property Value
TypeDescription
Google.LongRunning.OperationsClient

AsyncBatchAnnotateImagesOperationsClient

public virtual OperationsClient AsyncBatchAnnotateImagesOperationsClient { get; }

The long-running operations client for AsyncBatchAnnotateImages.

Property Value
TypeDescription
Google.LongRunning.OperationsClient

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the ImageAnnotator service, which is a host of "vision.googleapis.com" and a port of 443.

Property Value
TypeDescription
String

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default ImageAnnotator scopes.

Property Value
TypeDescription
IReadOnlyList<String>
Remarks

GrpcClient

public virtual ImageAnnotator.ImageAnnotatorClient GrpcClient { get; }

The underlying gRPC ImageAnnotator client

Property Value
TypeDescription
ImageAnnotator.ImageAnnotatorClient

Methods

Annotate(AnnotateImageRequest, CallSettings)

public virtual AnnotateImageResponse Annotate(AnnotateImageRequest request, CallSettings settings = null)

Annotates a single image.

Parameters
NameDescription
requestAnnotateImageRequest

The annotation request to process. Must not be null.

settingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
AnnotateImageResponse

The annotation response.

Remarks

This simply delegates to BatchAnnotateImages(IEnumerable<AnnotateImageRequest>, CallSettings) by creating a batch with a single request, and returns the single response.

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
AnnotateImageRequest request = new AnnotateImageRequest
{
    Image = image,
    Features =
    {
        new Feature { Type = Feature.Types.Type.FaceDetection },
        // By default, no limits are put on the number of results per annotation.
        // Use the MaxResults property to specify a limit.
        new Feature { Type = Feature.Types.Type.LandmarkDetection, MaxResults = 5 },
    }
};
AnnotateImageResponse response = client.Annotate(request);
Console.WriteLine("Faces:");
foreach (FaceAnnotation face in response.FaceAnnotations)
{
    string poly = string.Join(" - ", face.BoundingPoly.Vertices.Select(v => $"({v.X}, {v.Y})"));
    Console.WriteLine($"  Confidence: {(int)(face.DetectionConfidence * 100)}%; BoundingPoly: {poly}");
}
Console.WriteLine("Landmarks:");
foreach (EntityAnnotation landmark in response.LandmarkAnnotations)
{
    Console.WriteLine($"Score: {(int)(landmark.Score * 100)}%; Description: {landmark.Description}");
}
if (response.Error != null)
{
    Console.WriteLine($"Error detected: {response.Error}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

AnnotateAsync(AnnotateImageRequest, CallSettings)

public virtual Task<AnnotateImageResponse> AnnotateAsync(AnnotateImageRequest request, CallSettings settings = null)

Annotates a single image asynchronously.

Parameters
NameDescription
requestAnnotateImageRequest

The annotation request to process. Must not be null.

settingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
Task<AnnotateImageResponse>

A task representing the asynchronous operation. The task result will be the annotation response.

Remarks

This simply delegates to BatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest>, CallSettings) by creating a batch with a single request, and returns the single response.

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See Annotate for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

AnnotateAsync(AnnotateImageRequest, CancellationToken)

public virtual Task<AnnotateImageResponse> AnnotateAsync(AnnotateImageRequest request, CancellationToken cancellationToken)

Annotates a single image asynchronously.

Parameters
NameDescription
requestAnnotateImageRequest

The annotation request to process. Must not be null.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<AnnotateImageResponse>

A task representing the asynchronous operation. The task result will be the annotation response.

Remarks

This simply delegates to BatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest>, CallSettings) by creating a batch with a single request, and returns the single response.

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See Annotate for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest, CallSettings)

public virtual Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> AsyncBatchAnnotateFiles(AsyncBatchAnnotateFilesRequest request, CallSettings callSettings = null)

Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateFilesResponse (results).

Parameters
NameDescription
requestAsyncBatchAnnotateFilesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Google.LongRunning.Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>

The RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.Create();
// Initialize request argument(s)
AsyncBatchAnnotateFilesRequest request = new AsyncBatchAnnotateFilesRequest
{
    Requests =
    {
        new AsyncAnnotateFileRequest(),
    },
    Parent = "",
};
// Make the request
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> response = imageAnnotatorClient.AsyncBatchAnnotateFiles(request);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
AsyncBatchAnnotateFilesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> retrievedResponse = imageAnnotatorClient.PollOnceAsyncBatchAnnotateFiles(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateFilesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateFiles(IEnumerable<AsyncAnnotateFileRequest>, CallSettings)

public virtual Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> AsyncBatchAnnotateFiles(IEnumerable<AsyncAnnotateFileRequest> requests, CallSettings callSettings = null)

Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateFilesResponse (results).

Parameters
NameDescription
requestsIEnumerable<AsyncAnnotateFileRequest>

Required. Individual async file annotation requests for this batch.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Google.LongRunning.Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>

The RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.Create();
// Initialize request argument(s)
IEnumerable<AsyncAnnotateFileRequest> requests = new AsyncAnnotateFileRequest[]
{
    new AsyncAnnotateFileRequest(),
};
// Make the request
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> response = imageAnnotatorClient.AsyncBatchAnnotateFiles(requests);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
AsyncBatchAnnotateFilesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> retrievedResponse = imageAnnotatorClient.PollOnceAsyncBatchAnnotateFiles(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateFilesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateFilesAsync(AsyncBatchAnnotateFilesRequest, CallSettings)

public virtual Task<Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>> AsyncBatchAnnotateFilesAsync(AsyncBatchAnnotateFilesRequest request, CallSettings callSettings = null)

Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateFilesResponse (results).

Parameters
NameDescription
requestAsyncBatchAnnotateFilesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Google.LongRunning.Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>>

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
AsyncBatchAnnotateFilesRequest request = new AsyncBatchAnnotateFilesRequest
{
    Requests =
    {
        new AsyncAnnotateFileRequest(),
    },
    Parent = "",
};
// Make the request
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> response = await imageAnnotatorClient.AsyncBatchAnnotateFilesAsync(request);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AsyncBatchAnnotateFilesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> retrievedResponse = await imageAnnotatorClient.PollOnceAsyncBatchAnnotateFilesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateFilesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateFilesAsync(AsyncBatchAnnotateFilesRequest, CancellationToken)

public virtual Task<Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>> AsyncBatchAnnotateFilesAsync(AsyncBatchAnnotateFilesRequest request, CancellationToken cancellationToken)

Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateFilesResponse (results).

Parameters
NameDescription
requestAsyncBatchAnnotateFilesRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Google.LongRunning.Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>>

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
AsyncBatchAnnotateFilesRequest request = new AsyncBatchAnnotateFilesRequest
{
    Requests =
    {
        new AsyncAnnotateFileRequest(),
    },
    Parent = "",
};
// Make the request
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> response = await imageAnnotatorClient.AsyncBatchAnnotateFilesAsync(request);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AsyncBatchAnnotateFilesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> retrievedResponse = await imageAnnotatorClient.PollOnceAsyncBatchAnnotateFilesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateFilesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateFilesAsync(IEnumerable<AsyncAnnotateFileRequest>, CallSettings)

public virtual Task<Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>> AsyncBatchAnnotateFilesAsync(IEnumerable<AsyncAnnotateFileRequest> requests, CallSettings callSettings = null)

Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateFilesResponse (results).

Parameters
NameDescription
requestsIEnumerable<AsyncAnnotateFileRequest>

Required. Individual async file annotation requests for this batch.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Google.LongRunning.Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>>

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<AsyncAnnotateFileRequest> requests = new AsyncAnnotateFileRequest[]
{
    new AsyncAnnotateFileRequest(),
};
// Make the request
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> response = await imageAnnotatorClient.AsyncBatchAnnotateFilesAsync(requests);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AsyncBatchAnnotateFilesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> retrievedResponse = await imageAnnotatorClient.PollOnceAsyncBatchAnnotateFilesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateFilesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateFilesAsync(IEnumerable<AsyncAnnotateFileRequest>, CancellationToken)

public virtual Task<Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>> AsyncBatchAnnotateFilesAsync(IEnumerable<AsyncAnnotateFileRequest> requests, CancellationToken cancellationToken)

Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateFilesResponse (results).

Parameters
NameDescription
requestsIEnumerable<AsyncAnnotateFileRequest>

Required. Individual async file annotation requests for this batch.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Google.LongRunning.Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>>

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<AsyncAnnotateFileRequest> requests = new AsyncAnnotateFileRequest[]
{
    new AsyncAnnotateFileRequest(),
};
// Make the request
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> response = await imageAnnotatorClient.AsyncBatchAnnotateFilesAsync(requests);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AsyncBatchAnnotateFilesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> retrievedResponse = await imageAnnotatorClient.PollOnceAsyncBatchAnnotateFilesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateFilesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateImages(AsyncBatchAnnotateImagesRequest, CallSettings)

public virtual Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> AsyncBatchAnnotateImages(AsyncBatchAnnotateImagesRequest request, CallSettings callSettings = null)

Run asynchronous image detection and annotation for a list of images.

Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateImagesResponse (results).

This service will write image annotation outputs to json files in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto.

Parameters
NameDescription
requestAsyncBatchAnnotateImagesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Google.LongRunning.Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>

The RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.Create();
// Initialize request argument(s)
AsyncBatchAnnotateImagesRequest request = new AsyncBatchAnnotateImagesRequest
{
    Requests =
    {
        new AnnotateImageRequest(),
    },
    OutputConfig = new OutputConfig(),
    Parent = "",
};
// Make the request
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> response = imageAnnotatorClient.AsyncBatchAnnotateImages(request);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
AsyncBatchAnnotateImagesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> retrievedResponse = imageAnnotatorClient.PollOnceAsyncBatchAnnotateImages(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateImagesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateImages(IEnumerable<AnnotateImageRequest>, OutputConfig, CallSettings)

public virtual Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> AsyncBatchAnnotateImages(IEnumerable<AnnotateImageRequest> requests, OutputConfig outputConfig, CallSettings callSettings = null)

Run asynchronous image detection and annotation for a list of images.

Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateImagesResponse (results).

This service will write image annotation outputs to json files in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto.

Parameters
NameDescription
requestsIEnumerable<AnnotateImageRequest>

Required. Individual image annotation requests for this batch.

outputConfigOutputConfig

Required. The desired output location and metadata (e.g. format).

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Google.LongRunning.Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>

The RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.Create();
// Initialize request argument(s)
IEnumerable<AnnotateImageRequest> requests = new AnnotateImageRequest[]
{
    new AnnotateImageRequest(),
};
OutputConfig outputConfig = new OutputConfig();
// Make the request
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> response = imageAnnotatorClient.AsyncBatchAnnotateImages(requests, outputConfig);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> completedResponse = response.PollUntilCompleted();
// Retrieve the operation result
AsyncBatchAnnotateImagesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> retrievedResponse = imageAnnotatorClient.PollOnceAsyncBatchAnnotateImages(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateImagesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateImagesAsync(AsyncBatchAnnotateImagesRequest, CallSettings)

public virtual Task<Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>> AsyncBatchAnnotateImagesAsync(AsyncBatchAnnotateImagesRequest request, CallSettings callSettings = null)

Run asynchronous image detection and annotation for a list of images.

Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateImagesResponse (results).

This service will write image annotation outputs to json files in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto.

Parameters
NameDescription
requestAsyncBatchAnnotateImagesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Google.LongRunning.Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>>

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
AsyncBatchAnnotateImagesRequest request = new AsyncBatchAnnotateImagesRequest
{
    Requests =
    {
        new AnnotateImageRequest(),
    },
    OutputConfig = new OutputConfig(),
    Parent = "",
};
// Make the request
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> response = await imageAnnotatorClient.AsyncBatchAnnotateImagesAsync(request);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AsyncBatchAnnotateImagesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> retrievedResponse = await imageAnnotatorClient.PollOnceAsyncBatchAnnotateImagesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateImagesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateImagesAsync(AsyncBatchAnnotateImagesRequest, CancellationToken)

public virtual Task<Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>> AsyncBatchAnnotateImagesAsync(AsyncBatchAnnotateImagesRequest request, CancellationToken cancellationToken)

Run asynchronous image detection and annotation for a list of images.

Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateImagesResponse (results).

This service will write image annotation outputs to json files in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto.

Parameters
NameDescription
requestAsyncBatchAnnotateImagesRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Google.LongRunning.Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>>

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
AsyncBatchAnnotateImagesRequest request = new AsyncBatchAnnotateImagesRequest
{
    Requests =
    {
        new AnnotateImageRequest(),
    },
    OutputConfig = new OutputConfig(),
    Parent = "",
};
// Make the request
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> response = await imageAnnotatorClient.AsyncBatchAnnotateImagesAsync(request);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AsyncBatchAnnotateImagesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> retrievedResponse = await imageAnnotatorClient.PollOnceAsyncBatchAnnotateImagesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateImagesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest>, OutputConfig, CallSettings)

public virtual Task<Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>> AsyncBatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest> requests, OutputConfig outputConfig, CallSettings callSettings = null)

Run asynchronous image detection and annotation for a list of images.

Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateImagesResponse (results).

This service will write image annotation outputs to json files in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto.

Parameters
NameDescription
requestsIEnumerable<AnnotateImageRequest>

Required. Individual image annotation requests for this batch.

outputConfigOutputConfig

Required. The desired output location and metadata (e.g. format).

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Google.LongRunning.Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>>

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<AnnotateImageRequest> requests = new AnnotateImageRequest[]
{
    new AnnotateImageRequest(),
};
OutputConfig outputConfig = new OutputConfig();
// Make the request
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> response = await imageAnnotatorClient.AsyncBatchAnnotateImagesAsync(requests, outputConfig);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AsyncBatchAnnotateImagesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> retrievedResponse = await imageAnnotatorClient.PollOnceAsyncBatchAnnotateImagesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateImagesResponse retrievedResult = retrievedResponse.Result;
}

AsyncBatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest>, OutputConfig, CancellationToken)

public virtual Task<Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>> AsyncBatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest> requests, OutputConfig outputConfig, CancellationToken cancellationToken)

Run asynchronous image detection and annotation for a list of images.

Progress and results can be retrieved through the google.longrunning.Operations interface. Operation.metadata contains OperationMetadata (metadata). Operation.response contains AsyncBatchAnnotateImagesResponse (results).

This service will write image annotation outputs to json files in customer GCS bucket, each json file containing BatchAnnotateImagesResponse proto.

Parameters
NameDescription
requestsIEnumerable<AnnotateImageRequest>

Required. Individual image annotation requests for this batch.

outputConfigOutputConfig

Required. The desired output location and metadata (e.g. format).

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<Google.LongRunning.Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>>

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<AnnotateImageRequest> requests = new AnnotateImageRequest[]
{
    new AnnotateImageRequest(),
};
OutputConfig outputConfig = new OutputConfig();
// Make the request
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> response = await imageAnnotatorClient.AsyncBatchAnnotateImagesAsync(requests, outputConfig);

// Poll until the returned long-running operation is complete
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
// Retrieve the operation result
AsyncBatchAnnotateImagesResponse result = completedResponse.Result;

// Or get the name of the operation
string operationName = response.Name;
// This name can be stored, then the long-running operation retrieved later by name
Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> retrievedResponse = await imageAnnotatorClient.PollOnceAsyncBatchAnnotateImagesAsync(operationName);
// Check if the retrieved long-running operation has completed
if (retrievedResponse.IsCompleted)
{
    // If it has completed, then access the result
    AsyncBatchAnnotateImagesResponse retrievedResult = retrievedResponse.Result;
}

BatchAnnotateFiles(BatchAnnotateFilesRequest, CallSettings)

public virtual BatchAnnotateFilesResponse BatchAnnotateFiles(BatchAnnotateFilesRequest request, CallSettings callSettings = null)

Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported.

This service will extract at most 5 (customers can specify which 5 in AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation for each image extracted.

Parameters
NameDescription
requestBatchAnnotateFilesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
BatchAnnotateFilesResponse

The RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.Create();
// Initialize request argument(s)
BatchAnnotateFilesRequest request = new BatchAnnotateFilesRequest
{
    Requests =
    {
        new AnnotateFileRequest(),
    },
    Parent = "",
};
// Make the request
BatchAnnotateFilesResponse response = imageAnnotatorClient.BatchAnnotateFiles(request);

BatchAnnotateFiles(IEnumerable<AnnotateFileRequest>, CallSettings)

public virtual BatchAnnotateFilesResponse BatchAnnotateFiles(IEnumerable<AnnotateFileRequest> requests, CallSettings callSettings = null)

Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported.

This service will extract at most 5 (customers can specify which 5 in AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation for each image extracted.

Parameters
NameDescription
requestsIEnumerable<AnnotateFileRequest>

Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
BatchAnnotateFilesResponse

The RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.Create();
// Initialize request argument(s)
IEnumerable<AnnotateFileRequest> requests = new AnnotateFileRequest[]
{
    new AnnotateFileRequest(),
};
// Make the request
BatchAnnotateFilesResponse response = imageAnnotatorClient.BatchAnnotateFiles(requests);

BatchAnnotateFilesAsync(BatchAnnotateFilesRequest, CallSettings)

public virtual Task<BatchAnnotateFilesResponse> BatchAnnotateFilesAsync(BatchAnnotateFilesRequest request, CallSettings callSettings = null)

Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported.

This service will extract at most 5 (customers can specify which 5 in AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation for each image extracted.

Parameters
NameDescription
requestBatchAnnotateFilesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<BatchAnnotateFilesResponse>

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
BatchAnnotateFilesRequest request = new BatchAnnotateFilesRequest
{
    Requests =
    {
        new AnnotateFileRequest(),
    },
    Parent = "",
};
// Make the request
BatchAnnotateFilesResponse response = await imageAnnotatorClient.BatchAnnotateFilesAsync(request);

BatchAnnotateFilesAsync(BatchAnnotateFilesRequest, CancellationToken)

public virtual Task<BatchAnnotateFilesResponse> BatchAnnotateFilesAsync(BatchAnnotateFilesRequest request, CancellationToken cancellationToken)

Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported.

This service will extract at most 5 (customers can specify which 5 in AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation for each image extracted.

Parameters
NameDescription
requestBatchAnnotateFilesRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<BatchAnnotateFilesResponse>

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
BatchAnnotateFilesRequest request = new BatchAnnotateFilesRequest
{
    Requests =
    {
        new AnnotateFileRequest(),
    },
    Parent = "",
};
// Make the request
BatchAnnotateFilesResponse response = await imageAnnotatorClient.BatchAnnotateFilesAsync(request);

BatchAnnotateFilesAsync(IEnumerable<AnnotateFileRequest>, CallSettings)

public virtual Task<BatchAnnotateFilesResponse> BatchAnnotateFilesAsync(IEnumerable<AnnotateFileRequest> requests, CallSettings callSettings = null)

Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported.

This service will extract at most 5 (customers can specify which 5 in AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation for each image extracted.

Parameters
NameDescription
requestsIEnumerable<AnnotateFileRequest>

Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<BatchAnnotateFilesResponse>

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<AnnotateFileRequest> requests = new AnnotateFileRequest[]
{
    new AnnotateFileRequest(),
};
// Make the request
BatchAnnotateFilesResponse response = await imageAnnotatorClient.BatchAnnotateFilesAsync(requests);

BatchAnnotateFilesAsync(IEnumerable<AnnotateFileRequest>, CancellationToken)

public virtual Task<BatchAnnotateFilesResponse> BatchAnnotateFilesAsync(IEnumerable<AnnotateFileRequest> requests, CancellationToken cancellationToken)

Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported.

This service will extract at most 5 (customers can specify which 5 in AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation for each image extracted.

Parameters
NameDescription
requestsIEnumerable<AnnotateFileRequest>

Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<BatchAnnotateFilesResponse>

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<AnnotateFileRequest> requests = new AnnotateFileRequest[]
{
    new AnnotateFileRequest(),
};
// Make the request
BatchAnnotateFilesResponse response = await imageAnnotatorClient.BatchAnnotateFilesAsync(requests);

BatchAnnotateImages(BatchAnnotateImagesRequest, CallSettings)

public virtual BatchAnnotateImagesResponse BatchAnnotateImages(BatchAnnotateImagesRequest request, CallSettings callSettings = null)

Run image detection and annotation for a batch of images.

Parameters
NameDescription
requestBatchAnnotateImagesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
BatchAnnotateImagesResponse

The RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = ImageAnnotatorClient.Create();
// Initialize request argument(s)
BatchAnnotateImagesRequest request = new BatchAnnotateImagesRequest
{
    Requests =
    {
        new AnnotateImageRequest(),
    },
    Parent = "",
};
// Make the request
BatchAnnotateImagesResponse response = imageAnnotatorClient.BatchAnnotateImages(request);

BatchAnnotateImages(IEnumerable<AnnotateImageRequest>, CallSettings)

public virtual BatchAnnotateImagesResponse BatchAnnotateImages(IEnumerable<AnnotateImageRequest> requests, CallSettings callSettings = null)

Run image detection and annotation for a batch of images.

Parameters
NameDescription
requestsIEnumerable<AnnotateImageRequest>

Required. Individual image annotation requests for this batch.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
BatchAnnotateImagesResponse

The RPC response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
// Perform face recognition on one image, and logo recognition on another.
AnnotateImageRequest request1 = new AnnotateImageRequest
{
    Image = image1,
    Features = { new Feature { Type = Feature.Types.Type.FaceDetection } }
};
AnnotateImageRequest request2 = new AnnotateImageRequest
{
    Image = image2,
    Features = { new Feature { Type = Feature.Types.Type.LogoDetection } }
};

BatchAnnotateImagesResponse response = client.BatchAnnotateImages(new[] { request1, request2 });
Console.WriteLine("Faces in image 1:");
foreach (FaceAnnotation face in response.Responses[0].FaceAnnotations)
{
    string poly = string.Join(" - ", face.BoundingPoly.Vertices.Select(v => $"({v.X}, {v.Y})"));
    Console.WriteLine($"  Confidence: {(int)(face.DetectionConfidence * 100)}%; BoundingPoly: {poly}");
}
Console.WriteLine("Logos in image 2:");
foreach (EntityAnnotation logo in response.Responses[1].LogoAnnotations)
{
    Console.WriteLine($"Description: {logo.Description}");
}
foreach (Status error in response.Responses.Select(r => r.Error))
{
    Console.WriteLine($"Error detected: error");
}

BatchAnnotateImagesAsync(BatchAnnotateImagesRequest, CallSettings)

public virtual Task<BatchAnnotateImagesResponse> BatchAnnotateImagesAsync(BatchAnnotateImagesRequest request, CallSettings callSettings = null)

Run image detection and annotation for a batch of images.

Parameters
NameDescription
requestBatchAnnotateImagesRequest

The request object containing all of the parameters for the API call.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<BatchAnnotateImagesResponse>

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
BatchAnnotateImagesRequest request = new BatchAnnotateImagesRequest
{
    Requests =
    {
        new AnnotateImageRequest(),
    },
    Parent = "",
};
// Make the request
BatchAnnotateImagesResponse response = await imageAnnotatorClient.BatchAnnotateImagesAsync(request);

BatchAnnotateImagesAsync(BatchAnnotateImagesRequest, CancellationToken)

public virtual Task<BatchAnnotateImagesResponse> BatchAnnotateImagesAsync(BatchAnnotateImagesRequest request, CancellationToken cancellationToken)

Run image detection and annotation for a batch of images.

Parameters
NameDescription
requestBatchAnnotateImagesRequest

The request object containing all of the parameters for the API call.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<BatchAnnotateImagesResponse>

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
BatchAnnotateImagesRequest request = new BatchAnnotateImagesRequest
{
    Requests =
    {
        new AnnotateImageRequest(),
    },
    Parent = "",
};
// Make the request
BatchAnnotateImagesResponse response = await imageAnnotatorClient.BatchAnnotateImagesAsync(request);

BatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest>, CallSettings)

public virtual Task<BatchAnnotateImagesResponse> BatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest> requests, CallSettings callSettings = null)

Run image detection and annotation for a batch of images.

Parameters
NameDescription
requestsIEnumerable<AnnotateImageRequest>

Required. Individual image annotation requests for this batch.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<BatchAnnotateImagesResponse>

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<AnnotateImageRequest> requests = new AnnotateImageRequest[]
{
    new AnnotateImageRequest(),
};
// Make the request
BatchAnnotateImagesResponse response = await imageAnnotatorClient.BatchAnnotateImagesAsync(requests);

BatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest>, CancellationToken)

public virtual Task<BatchAnnotateImagesResponse> BatchAnnotateImagesAsync(IEnumerable<AnnotateImageRequest> requests, CancellationToken cancellationToken)

Run image detection and annotation for a batch of images.

Parameters
NameDescription
requestsIEnumerable<AnnotateImageRequest>

Required. Individual image annotation requests for this batch.

cancellationTokenCancellationToken

A CancellationToken to use for this RPC.

Returns
TypeDescription
Task<BatchAnnotateImagesResponse>

A Task containing the RPC response.

Example
// Create client
ImageAnnotatorClient imageAnnotatorClient = await ImageAnnotatorClient.CreateAsync();
// Initialize request argument(s)
IEnumerable<AnnotateImageRequest> requests = new AnnotateImageRequest[]
{
    new AnnotateImageRequest(),
};
// Make the request
BatchAnnotateImagesResponse response = await imageAnnotatorClient.BatchAnnotateImagesAsync(requests);

Create()

public static ImageAnnotatorClient Create()

Synchronously creates a ImageAnnotatorClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ImageAnnotatorClientBuilder.

Returns
TypeDescription
ImageAnnotatorClient

The created ImageAnnotatorClient.

CreateAsync(CancellationToken)

public static Task<ImageAnnotatorClient> CreateAsync(CancellationToken cancellationToken = default(CancellationToken))

Asynchronously creates a ImageAnnotatorClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use ImageAnnotatorClientBuilder.

Parameter
NameDescription
cancellationTokenCancellationToken

The CancellationToken to use while creating the client.

Returns
TypeDescription
Task<ImageAnnotatorClient>

The task representing the created ImageAnnotatorClient.

DetectCropHints(Image, ImageContext, CallSettings)

public virtual CropHintsAnnotation DetectCropHints(Image image, ImageContext context = null, CallSettings callSettings = null)

Suggests crop hints for a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
CropHintsAnnotation

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
CropHintsAnnotation cropHints = client.DetectCropHints(image);
foreach (CropHint hint in cropHints.CropHints)
{
    Console.WriteLine("Crop hint:");
    string poly = string.Join(" - ", hint.BoundingPoly.Vertices.Select(v => $"({v.X}, {v.Y})"));
    Console.WriteLine($"  Poly: {poly}");
    Console.WriteLine($"  Confidence: {hint.Confidence}");
    Console.WriteLine($"  Importance fraction: {hint.ImportanceFraction}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectCropHintsAsync(Image, ImageContext, CallSettings)

public virtual Task<CropHintsAnnotation> DetectCropHintsAsync(Image image, ImageContext context = null, CallSettings callSettings = null)

Suggests crop hints for a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
Task<CropHintsAnnotation>

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectCropHints for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectDocumentText(Image, ImageContext, CallSettings)

public virtual TextAnnotation DetectDocumentText(Image image, ImageContext context = null, CallSettings callSettings = null)

Detects document text in a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
TextAnnotation

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
TextAnnotation text = client.DetectDocumentText(image);
Console.WriteLine($"Text: {text.Text}");
foreach (var page in text.Pages)
{
    foreach (var block in page.Blocks)
    {
        string box = string.Join(" - ", block.BoundingBox.Vertices.Select(v => $"({v.X}, {v.Y})"));
        Console.WriteLine($"Block {block.BlockType} at {box}");
        foreach (var paragraph in block.Paragraphs)
        {
            box = string.Join(" - ", paragraph.BoundingBox.Vertices.Select(v => $"({v.X}, {v.Y})"));
            Console.WriteLine($"  Paragraph at {box}");
            foreach (var word in paragraph.Words)
            {
                Console.WriteLine($"    Word: {string.Join("", word.Symbols.Select(s => s.Text))}");
            }
        }
    }
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectDocumentTextAsync(Image, ImageContext, CallSettings)

public virtual Task<TextAnnotation> DetectDocumentTextAsync(Image image, ImageContext context = null, CallSettings callSettings = null)

Detects document text in a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
Task<TextAnnotation>

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectDocumentText for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectFaces(Image, ImageContext, Int32, CallSettings)

public virtual IReadOnlyList<FaceAnnotation> DetectFaces(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects the faces in a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsInt32

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
IReadOnlyList<FaceAnnotation>

A set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
IReadOnlyList<FaceAnnotation> result = client.DetectFaces(image);
foreach (FaceAnnotation face in result)
{
    string poly = string.Join(" - ", face.BoundingPoly.Vertices.Select(v => $"({v.X}, {v.Y})"));
    Console.WriteLine($"Confidence: {(int)(face.DetectionConfidence * 100)}%; BoundingPoly: {poly}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectFacesAsync(Image, ImageContext, Int32, CallSettings)

public virtual Task<IReadOnlyList<FaceAnnotation>> DetectFacesAsync(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects the faces in a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsInt32

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
Task<IReadOnlyList<FaceAnnotation>>

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectFaces for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectImageProperties(Image, ImageContext, CallSettings)

public virtual ImageProperties DetectImageProperties(Image image, ImageContext context = null, CallSettings callSettings = null)

Performs image property processing on a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
ImageProperties

The detected properties for the image.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
ImageProperties properties = client.DetectImageProperties(image);
ColorInfo dominantColor = properties.DominantColors.Colors.OrderByDescending(c => c.PixelFraction).First();
Console.WriteLine($"Dominant color in image: {dominantColor}");
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectImagePropertiesAsync(Image, ImageContext, CallSettings)

public virtual Task<ImageProperties> DetectImagePropertiesAsync(Image image, ImageContext context = null, CallSettings callSettings = null)

Performs image property processing on a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
Task<ImageProperties>

A task representing the asynchronous operation. The task result will be the detected properties for the image.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectImageProperties for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectLabels(Image, ImageContext, Int32, CallSettings)

public virtual IReadOnlyList<EntityAnnotation> DetectLabels(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects labels for a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsInt32

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
IReadOnlyList<EntityAnnotation>

A set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
IReadOnlyList<EntityAnnotation> labels = client.DetectLabels(image);
foreach (EntityAnnotation label in labels)
{
    Console.WriteLine($"Score: {(int)(label.Score * 100)}%; Description: {label.Description}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectLabelsAsync(Image, ImageContext, Int32, CallSettings)

public virtual Task<IReadOnlyList<EntityAnnotation>> DetectLabelsAsync(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects labels for a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsInt32

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
Task<IReadOnlyList<EntityAnnotation>>

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectLabels for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectLandmarks(Image, ImageContext, Int32, CallSettings)

public virtual IReadOnlyList<EntityAnnotation> DetectLandmarks(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects landmarks in a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsInt32

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
IReadOnlyList<EntityAnnotation>

A set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
IReadOnlyList<EntityAnnotation> result = client.DetectLandmarks(image);
foreach (EntityAnnotation landmark in result)
{
    Console.WriteLine($"Score: {(int)(landmark.Score * 100)}%; Description: {landmark.Description}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectLandmarksAsync(Image, ImageContext, Int32, CallSettings)

public virtual Task<IReadOnlyList<EntityAnnotation>> DetectLandmarksAsync(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects the landmarks in a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsInt32

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
Task<IReadOnlyList<EntityAnnotation>>

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectLandmarks for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectLocalizedObjects(Image, ImageContext, Int32, CallSettings)

public virtual IReadOnlyList<LocalizedObjectAnnotation> DetectLocalizedObjects(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects localized objects in a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsInt32

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
IReadOnlyList<LocalizedObjectAnnotation>

A set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
IReadOnlyList<LocalizedObjectAnnotation> annotations = client.DetectLocalizedObjects(image);
foreach (LocalizedObjectAnnotation annotation in annotations)
{
    string poly = string.Join(" - ", annotation.BoundingPoly.NormalizedVertices.Select(v => $"({v.X}, {v.Y})"));
    Console.WriteLine(
        $"Name: {annotation.Name}; ID: {annotation.Mid}; Score: {annotation.Score}; Bounding poly: {poly}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectLocalizedObjectsAsync(Image, ImageContext, Int32, CallSettings)

public virtual Task<IReadOnlyList<LocalizedObjectAnnotation>> DetectLocalizedObjectsAsync(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects localized objects in a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsInt32

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
Task<IReadOnlyList<LocalizedObjectAnnotation>>

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectLocalizedObjects for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectLogos(Image, ImageContext, Int32, CallSettings)

public virtual IReadOnlyList<EntityAnnotation> DetectLogos(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects logos in a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsInt32

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
IReadOnlyList<EntityAnnotation>

A set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
IReadOnlyList<EntityAnnotation> logos = client.DetectLogos(image);
foreach (EntityAnnotation logo in logos)
{
    Console.WriteLine($"Description: {logo.Description}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectLogosAsync(Image, ImageContext, Int32, CallSettings)

public virtual Task<IReadOnlyList<EntityAnnotation>> DetectLogosAsync(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects logos in a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsInt32

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
Task<IReadOnlyList<EntityAnnotation>>

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectLogos for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectSafeSearch(Image, ImageContext, CallSettings)

public virtual SafeSearchAnnotation DetectSafeSearch(Image image, ImageContext context = null, CallSettings callSettings = null)

Performs "safe search" processing on a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
SafeSearchAnnotation

The safe search categorization for the image.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
SafeSearchAnnotation annotation = client.DetectSafeSearch(image);
// Each category is classified as Very Unlikely, Unlikely, Possible, Likely or Very Likely.
Console.WriteLine($"Adult? {annotation.Adult}");
Console.WriteLine($"Spoof? {annotation.Spoof}");
Console.WriteLine($"Violence? {annotation.Violence}");
Console.WriteLine($"Medical? {annotation.Medical}");
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectSafeSearchAsync(Image, ImageContext, CallSettings)

public virtual Task<SafeSearchAnnotation> DetectSafeSearchAsync(Image image, ImageContext context = null, CallSettings callSettings = null)

Performs "safe search" processing on a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
Task<SafeSearchAnnotation>

A task representing the asynchronous operation. The task result will be the safe search categorization for the image.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectSafeSearch for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectSimilarProducts(Image, ProductSearchParams, CallSettings)

public virtual ProductSearchResults DetectSimilarProducts(Image image, ProductSearchParams productSearchParams, CallSettings callSettings = null)

Performs product detection on a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

productSearchParamsProductSearchParams

Product search parameters. Must not be null.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
ProductSearchResults

The detected properties for the image.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ProductSetName productSetName = new ProductSetName(projectId, locationId, productSetId);
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
ProductSearchParams searchParams = new ProductSearchParams
{
    ProductCategories = { "apparel" },
    ProductSetAsProductSetName = productSetName,
};
ProductSearchResults results = client.DetectSimilarProducts(image, searchParams);
foreach (var result in results.Results)
{
    Console.WriteLine($"{result.Product.DisplayName}: {result.Score}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectSimilarProductsAsync(Image, ProductSearchParams, CallSettings)

public virtual Task<ProductSearchResults> DetectSimilarProductsAsync(Image image, ProductSearchParams productSearchParams, CallSettings callSettings = null)

Performs product detection on a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

productSearchParamsProductSearchParams

Product search parameters. Must not be null.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
Task<ProductSearchResults>

A task representing the asynchronous operation. The task result will be the detected properties for the image.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectSimilarProducts for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectText(Image, ImageContext, Int32, CallSettings)

public virtual IReadOnlyList<EntityAnnotation> DetectText(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects text in a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsInt32

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
IReadOnlyList<EntityAnnotation>

A set of annotations.

Remarks

This method is suitable for an image with individual words; for more structured text, use DetectDocumentText(Image, ImageContext, CallSettings).

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
IReadOnlyList<EntityAnnotation> textAnnotations = client.DetectText(image);
foreach (EntityAnnotation text in textAnnotations)
{
    Console.WriteLine($"Description: {text.Description}");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectTextAsync(Image, ImageContext, Int32, CallSettings)

public virtual Task<IReadOnlyList<EntityAnnotation>> DetectTextAsync(Image image, ImageContext context = null, int maxResults = 0, CallSettings callSettings = null)

Detects text in a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

maxResultsInt32

The maximum number of results to return. 0 (the default) means "unlimited". Must not be negative.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
Task<IReadOnlyList<EntityAnnotation>>

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

This method is suitable for an image with individual words; for more structured text, use DetectDocumentTextAsync(Image, ImageContext, CallSettings).

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectText for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectWebInformation(Image, ImageContext, CallSettings)

public virtual WebDetection DetectWebInformation(Image image, ImageContext context = null, CallSettings callSettings = null)

Performs web detection for a single image.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
WebDetection

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example
ImageAnnotatorClient client = ImageAnnotatorClient.Create();
WebDetection webDetection = client.DetectWebInformation(image);
foreach (WebDetection.Types.WebImage webImage in webDetection.FullMatchingImages)
{
    Console.WriteLine($"Full image: {webImage.Url} ({webImage.Score})");
}
foreach (WebDetection.Types.WebImage webImage in webDetection.PartialMatchingImages)
{
    Console.WriteLine($"Partial image: {webImage.Url} ({webImage.Score})");
}
foreach (WebDetection.Types.WebPage webPage in webDetection.PagesWithMatchingImages)
{
    Console.WriteLine($"Page with matching image: {webPage.Url} ({webPage.Score})");
}
foreach (WebDetection.Types.WebEntity entity in webDetection.WebEntities)
{
    Console.WriteLine($"Web entity: {entity.EntityId} / {entity.Description} ({entity.Score})");
}
Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

DetectWebInformationAsync(Image, ImageContext, CallSettings)

public virtual Task<WebDetection> DetectWebInformationAsync(Image image, ImageContext context = null, CallSettings callSettings = null)

Performs web detection for a single image asynchronously.

Parameters
NameDescription
imageImage

The image to process. Must not be null.

contextImageContext

Additional contextual information, if any.

callSettingsCallSettings

Call settings to apply to the RPC, if any.

Returns
TypeDescription
Task<WebDetection>

A task representing the asynchronous operation. The task result will be a set of annotations.

Remarks

If AnnotateImageException is thrown, the original response can still be retrieved using Response.

Example

See DetectWebInformation for a synchronous example.

Exceptions
TypeDescription
AnnotateImageException

The RPC returns a response, but the response contains an error.

PollOnceAsyncBatchAnnotateFiles(String, CallSettings)

public virtual Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata> PollOnceAsyncBatchAnnotateFiles(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of AsyncBatchAnnotateFiles.

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Google.LongRunning.Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>

The result of polling the operation.

PollOnceAsyncBatchAnnotateFilesAsync(String, CallSettings)

public virtual Task<Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>> PollOnceAsyncBatchAnnotateFilesAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of AsyncBatchAnnotateFiles.

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Google.LongRunning.Operation<AsyncBatchAnnotateFilesResponse, OperationMetadata>>

A task representing the result of polling the operation.

PollOnceAsyncBatchAnnotateImages(String, CallSettings)

public virtual Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata> PollOnceAsyncBatchAnnotateImages(string operationName, CallSettings callSettings = null)

Poll an operation once, using an operationName from a previous invocation of AsyncBatchAnnotateImages.

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Google.LongRunning.Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>

The result of polling the operation.

PollOnceAsyncBatchAnnotateImagesAsync(String, CallSettings)

public virtual Task<Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>> PollOnceAsyncBatchAnnotateImagesAsync(string operationName, CallSettings callSettings = null)

Asynchronously poll an operation once, using an operationName from a previous invocation of AsyncBatchAnnotateImages.

Parameters
NameDescription
operationNameString

The name of a previously invoked operation. Must not be null or empty.

callSettingsCallSettings

If not null, applies overrides to this RPC call.

Returns
TypeDescription
Task<Google.LongRunning.Operation<AsyncBatchAnnotateImagesResponse, OperationMetadata>>

A task representing the result of polling the operation.

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
TypeDescription
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.